src/network/network_gui.cpp
author peter1138
Sun, 03 Aug 2008 17:35:08 +0000
changeset 9834 7474149531c1
parent 9827 338aac16d11b
child 9897 4d9a6ff6703e
permissions -rw-r--r--
(svn r13977) -Codechange: Let ResizeWindowForWidget() handle hidden (zero height or zero width) widgets.
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2163
diff changeset
     1
/* $Id$ */
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2163
diff changeset
     2
9111
48ce04029fe4 (svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents: 8937
diff changeset
     3
/** @file network_gui.cpp Implementation of the Network related GUIs. */
48ce04029fe4 (svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents: 8937
diff changeset
     4
4826
6a545d194528 (svn r6750) -Codechange: Juggle around some header includes as they're only used when
Darkvater
parents: 4774
diff changeset
     5
#ifdef ENABLE_NETWORK
5469
7edfc643abbc (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: 5432
diff changeset
     6
#include "../stdafx.h"
7edfc643abbc (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: 5432
diff changeset
     7
#include "../openttd.h"
8114
dd6d21dc99c1 (svn r11675) -Codechange: split the string types from the string functions.
rubidium
parents: 8107
diff changeset
     8
#include "../strings_func.h"
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
     9
#include "network.h"
8140
0d0d8c94f84b (svn r11702) -Codechange: move all date related stuff to date*.
rubidium
parents: 8131
diff changeset
    10
#include "../date_func.h"
5469
7edfc643abbc (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: 5432
diff changeset
    11
#include "../fios.h"
9428
1ba05b499957 (svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium
parents: 9420
diff changeset
    12
#include "network_internal.h"
4013
53a7dd9a1fbf (svn r5226) Reduce the mess that sending chat messages is
tron
parents: 3860
diff changeset
    13
#include "network_client.h"
4826
6a545d194528 (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
b96ab9e63d22 (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"
5469
7edfc643abbc (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: 5432
diff changeset
    16
#include "../gui.h"
8107
bb7deea89175 (svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents: 8106
diff changeset
    17
#include "../window_gui.h"
bb7deea89175 (svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents: 8106
diff changeset
    18
#include "../textbuf_gui.h"
5469
7edfc643abbc (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: 5432
diff changeset
    19
#include "../variables.h"
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
    20
#include "network_server.h"
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
    21
#include "network_udp.h"
5469
7edfc643abbc (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: 5432
diff changeset
    22
#include "../town.h"
7edfc643abbc (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: 5432
diff changeset
    23
#include "../newgrf.h"
8131
160939e24ed3 (svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium
parents: 8130
diff changeset
    24
#include "../functions.h"
160939e24ed3 (svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium
parents: 8130
diff changeset
    25
#include "../window_func.h"
8213
7bdd7593eb9b (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium
parents: 8208
diff changeset
    26
#include "../core/alloc_func.hpp"
8214
971f861d5543 (svn r11777) -Codechange: split the string header and make do not include it when it's not necessary.
rubidium
parents: 8213
diff changeset
    27
#include "../string_func.h"
8224
c5a64d87cc54 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8214
diff changeset
    28
#include "../gfx_func.h"
8254
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8224
diff changeset
    29
#include "../player_func.h"
8270
e7c342f6b14c (svn r11834) -Codechange: only include settings_type.h if needed.
rubidium
parents: 8264
diff changeset
    30
#include "../settings_type.h"
8284
ebdc5ba08874 (svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents: 8270
diff changeset
    31
#include "../widgets/dropdown_func.h"
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
    32
#include "../querystring_gui.h"
9274
42b67e65f1c2 (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: 9273
diff changeset
    33
#include "../sortlist_type.h"
9659
187142ff9b6c (svn r13731) -Codechange: make a pool of the array of players.
rubidium
parents: 9652
diff changeset
    34
#include "../player_base.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    35
8264
b1e85998c7d3 (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents: 8254
diff changeset
    36
#include "table/strings.h"
b1e85998c7d3 (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents: 8254
diff changeset
    37
#include "../table/sprites.h"
b1e85998c7d3 (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents: 8254
diff changeset
    38
2887
810e555d5249 (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
    39
4315
2e634e3ecd02 (svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents: 4300
diff changeset
    40
static bool _chat_tab_completion_active;
3470
cd704e52732f (svn r4315) Remove MAX_QUERYSTR_LEN, rather use lengthof() the real thing
tron
parents: 3469
diff changeset
    41
6247
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5916
diff changeset
    42
static void ShowNetworkStartServerWindow();
2887
810e555d5249 (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
static void ShowNetworkLobbyWindow(NetworkGameList *ngl);
4300
c7e43c47a2b9 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4299
diff changeset
    44
extern void SwitchMode(int new_mode);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    45
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    46
static const StringID _connection_types_dropdown[] = {
675
9be22ffb4625 (svn r1113) -Add: [Network] Added the GUI part for server advertising. When you go
truelight
parents: 670
diff changeset
    47
	STR_NETWORK_LAN_INTERNET,
9be22ffb4625 (svn r1113) -Add: [Network] Added the GUI part for server advertising. When you go
truelight
parents: 670
diff changeset
    48
	STR_NETWORK_INTERNET_ADVERTISE,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    49
	INVALID_STRING_ID
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    50
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    51
764
7e1e17b7c7d4 (svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents: 749
diff changeset
    52
static const StringID _lan_internet_types_dropdown[] = {
7e1e17b7c7d4 (svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents: 749
diff changeset
    53
	STR_NETWORK_LAN,
7e1e17b7c7d4 (svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents: 749
diff changeset
    54
	STR_NETWORK_INTERNET,
7e1e17b7c7d4 (svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents: 749
diff changeset
    55
	INVALID_STRING_ID
7e1e17b7c7d4 (svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents: 749
diff changeset
    56
};
7e1e17b7c7d4 (svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents: 749
diff changeset
    57
6796
ff1875ba196d (svn r10035) -Change: simplified network language string sorting
glx
parents: 6793
diff changeset
    58
static StringID _language_dropdown[NETLANG_COUNT + 1] = {STR_NULL};
6793
05d91fa1c75c (svn r10032) -Add: sort the strings in server language dropdown
glx
parents: 6780
diff changeset
    59
7321
f91bdca345e8 (svn r10684) -Codechange: some more coding style related changes. Primarily moving { to a new line.
rubidium
parents: 7221
diff changeset
    60
void SortNetworkLanguages()
f91bdca345e8 (svn r10684) -Codechange: some more coding style related changes. Primarily moving { to a new line.
rubidium
parents: 7221
diff changeset
    61
{
6796
ff1875ba196d (svn r10035) -Change: simplified network language string sorting
glx
parents: 6793
diff changeset
    62
	/* Init the strings */
ff1875ba196d (svn r10035) -Change: simplified network language string sorting
glx
parents: 6793
diff changeset
    63
	if (_language_dropdown[0] == STR_NULL) {
ff1875ba196d (svn r10035) -Change: simplified network language string sorting
glx
parents: 6793
diff changeset
    64
		for (int i = 0; i < NETLANG_COUNT; i++) _language_dropdown[i] = STR_NETWORK_LANG_ANY + i;
ff1875ba196d (svn r10035) -Change: simplified network language string sorting
glx
parents: 6793
diff changeset
    65
		_language_dropdown[NETLANG_COUNT] = INVALID_STRING_ID;
ff1875ba196d (svn r10035) -Change: simplified network language string sorting
glx
parents: 6793
diff changeset
    66
	}
6793
05d91fa1c75c (svn r10032) -Add: sort the strings in server language dropdown
glx
parents: 6780
diff changeset
    67
6796
ff1875ba196d (svn r10035) -Change: simplified network language string sorting
glx
parents: 6793
diff changeset
    68
	/* Sort the strings (we don't move 'any' and the 'invalid' one) */
ff1875ba196d (svn r10035) -Change: simplified network language string sorting
glx
parents: 6793
diff changeset
    69
	qsort(&_language_dropdown[1], NETLANG_COUNT - 1, sizeof(StringID), &StringIDSorter);
6793
05d91fa1c75c (svn r10032) -Add: sort the strings in server language dropdown
glx
parents: 6780
diff changeset
    70
}
6780
ba49b125d95e (svn r10017) -Add (FS#790): more languages flags for servers
glx
parents: 6531
diff changeset
    71
211
2954c4b30525 (svn r212) -Fix: Network-gui fixes (sign_de)
darkvater
parents: 206
diff changeset
    72
enum {
2881
ade9a553be53 (svn r3429) - Feature (Followup): Change the gamelist window to accomodate for the new information.
Darkvater
parents: 2879
diff changeset
    73
	NET_PRC__OFFSET_TOP_WIDGET          = 54,
2887
810e555d5249 (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
    74
	NET_PRC__OFFSET_TOP_WIDGET_COMPANY  = 52,
2881
ade9a553be53 (svn r3429) - Feature (Followup): Change the gamelist window to accomodate for the new information.
Darkvater
parents: 2879
diff changeset
    75
	NET_PRC__SIZE_OF_ROW                = 14,
211
2954c4b30525 (svn r212) -Fix: Network-gui fixes (sign_de)
darkvater
parents: 206
diff changeset
    76
};
2954c4b30525 (svn r212) -Fix: Network-gui fixes (sign_de)
darkvater
parents: 206
diff changeset
    77
5035
1bcefcae0ef4 (svn r7077) -Codechange: Send proper message to network window, and handle selection control in
Darkvater
parents: 4957
diff changeset
    78
/** Update the network new window because a new server is
1bcefcae0ef4 (svn r7077) -Codechange: Send proper message to network window, and handle selection control in
Darkvater
parents: 4957
diff changeset
    79
 * found on the network.
1bcefcae0ef4 (svn r7077) -Codechange: Send proper message to network window, and handle selection control in
Darkvater
parents: 4957
diff changeset
    80
 * @param unselect unselect the currently selected item */
897
076a21cc614a (svn r1383) Fix: You can now also delete automatically found servers by pressing "del"
dominik
parents: 893
diff changeset
    81
void UpdateNetworkGameWindow(bool unselect)
076a21cc614a (svn r1383) Fix: You can now also delete automatically found servers by pressing "del"
dominik
parents: 893
diff changeset
    82
{
9165
6f26cc347e7a (svn r13028) -Codechange: WE_MESSAGE and WE_INVALIDATE_DATA were doing the same thing.
rubidium
parents: 9164
diff changeset
    83
	InvalidateWindowData(WC_NETWORK_WINDOW, 0, unselect);
897
076a21cc614a (svn r1383) Fix: You can now also delete automatically found servers by pressing "del"
dominik
parents: 893
diff changeset
    84
}
076a21cc614a (svn r1383) Fix: You can now also delete automatically found servers by pressing "del"
dominik
parents: 893
diff changeset
    85
7960
b88d72baa45b (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 7959
diff changeset
    86
/** Enum for NetworkGameWindow, referring to _network_game_window_widgets */
b88d72baa45b (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 7959
diff changeset
    87
enum NetworkGameWindowWidgets {
8931
05c473750db1 (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 8738
diff changeset
    88
	NGWW_CLOSE,         ///< Close 'X' button
05c473750db1 (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 8738
diff changeset
    89
	NGWW_CAPTION,       ///< Caption of the window
05c473750db1 (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 8738
diff changeset
    90
	NGWW_RESIZE,        ///< Resize button
7960
b88d72baa45b (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 7959
diff changeset
    91
8931
05c473750db1 (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 8738
diff changeset
    92
	NGWW_CONNECTION,    ///< Label in from of connection droplist
05c473750db1 (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 8738
diff changeset
    93
	NGWW_CONN_BTN,      ///< 'Connection' droplist button
05c473750db1 (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 8738
diff changeset
    94
	NGWW_PLAYER,        ///< Panel with editbox to set player name
05c473750db1 (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 8738
diff changeset
    95
05c473750db1 (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 8738
diff changeset
    96
	NGWW_NAME,          ///< 'Name' button
7960
b88d72baa45b (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 7959
diff changeset
    97
	NGWW_CLIENTS,       ///< 'Clients' button
9660
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
    98
	NGWW_MAPSIZE,       ///< 'Map size' button
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
    99
	NGWW_DATE,          ///< 'Date' button
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   100
	NGWW_YEARS,         ///< 'Years' button
7960
b88d72baa45b (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 7959
diff changeset
   101
	NGWW_INFO,          ///< Third button in the game list panel
b88d72baa45b (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 7959
diff changeset
   102
8931
05c473750db1 (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 8738
diff changeset
   103
	NGWW_MATRIX,        ///< Panel with list of games
05c473750db1 (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 8738
diff changeset
   104
	NGWW_SCROLLBAR,     ///< Scrollbar of matrix
7960
b88d72baa45b (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 7959
diff changeset
   105
8937
9a4da442dd50 (svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium
parents: 8931
diff changeset
   106
	NGWW_LASTJOINED_LABEL, ///< Label "Last joined server:"
9a4da442dd50 (svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium
parents: 8931
diff changeset
   107
	NGWW_LASTJOINED,    ///< Info about the last joined server
9a4da442dd50 (svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium
parents: 8931
diff changeset
   108
8931
05c473750db1 (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 8738
diff changeset
   109
	NGWW_DETAILS,       ///< Panel with game details
05c473750db1 (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 8738
diff changeset
   110
	NGWW_JOIN,          ///< 'Join game' button
05c473750db1 (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 8738
diff changeset
   111
	NGWW_REFRESH,       ///< 'Refresh server' button
05c473750db1 (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 8738
diff changeset
   112
	NGWW_NEWGRF,        ///< 'NewGRF Settings' button
7960
b88d72baa45b (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 7959
diff changeset
   113
8931
05c473750db1 (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 8738
diff changeset
   114
	NGWW_FIND,          ///< 'Find server' button
7960
b88d72baa45b (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 7959
diff changeset
   115
	NGWW_ADD,           ///< 'Add server' button
b88d72baa45b (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 7959
diff changeset
   116
	NGWW_START,         ///< 'Start server' button
b88d72baa45b (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 7959
diff changeset
   117
	NGWW_CANCEL,        ///< 'Cancel' button
b88d72baa45b (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 7959
diff changeset
   118
};
b88d72baa45b (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 7959
diff changeset
   119
9182
412cb6c0caf1 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 9181
diff changeset
   120
typedef GUIList<NetworkGameList*> GUIGameServerList;
412cb6c0caf1 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 9181
diff changeset
   121
9414
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   122
class NetworkGameWindow : public QueryStringBaseWindow {
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   123
protected:
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   124
	/* Runtime saved values */
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   125
	static Listing last_sorting;
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   126
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   127
	/* Constants for sorting servers */
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   128
	static GUIGameServerList::SortFunction *const sorter_funcs[];
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   129
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   130
	byte field;                  ///< selected text-field
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   131
	NetworkGameList *server;     ///< selected server
9182
412cb6c0caf1 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 9181
diff changeset
   132
	GUIGameServerList servers;   ///< list with game servers.
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   133
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   134
	/**
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   135
	 * (Re)build the network game list as its amount has changed because
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   136
	 * an item has been added or deleted for example
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   137
	 */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   138
	void BuildNetworkGameList()
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   139
	{
9414
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   140
		if (!this->servers.NeedRebuild()) return;
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   141
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   142
		/* Create temporary array of games to use for listing */
9365
95e9cbc0257e (svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents: 9354
diff changeset
   143
		this->servers.Clear();
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   144
9365
95e9cbc0257e (svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents: 9354
diff changeset
   145
		for (NetworkGameList *ngl = _network_game_list; ngl != NULL; ngl = ngl->next) {
95e9cbc0257e (svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents: 9354
diff changeset
   146
			*this->servers.Append() = ngl;
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   147
		}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   148
9365
95e9cbc0257e (svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents: 9354
diff changeset
   149
		this->servers.Compact();
9414
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   150
		this->servers.RebuildDone();
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   151
	}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   152
9414
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   153
	/** Sort servers by name. */
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   154
	static int CDECL NGameNameSorter(NetworkGameList* const *a, NetworkGameList* const *b)
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   155
	{
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   156
		return strcasecmp((*a)->info.server_name, (*b)->info.server_name);
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   157
	}
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   158
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   159
	/** Sort servers by the amount of clients online on a
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   160
	 * server. If the two servers have the same amount, the one with the
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   161
	 * higher maximum is preferred. */
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   162
	static int CDECL NGameClientSorter(NetworkGameList* const *a, NetworkGameList* const *b)
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   163
	{
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   164
		/* Reverse as per default we are interested in most-clients first */
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   165
		int r = (*a)->info.clients_on - (*b)->info.clients_on;
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   166
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   167
		if (r == 0) r = (*a)->info.clients_max - (*b)->info.clients_max;
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   168
		if (r == 0) r = NGameNameSorter(a, b);
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   169
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   170
		return r;
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   171
	}
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   172
9660
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   173
	/** Sort servers by map size */
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   174
	static int CDECL NGameMapSizeSorter(NetworkGameList* const *a, NetworkGameList* const *b)
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   175
	{
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   176
		/* Sort by the area of the map. */
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   177
		int r = ((*a)->info.map_height) * ((*a)->info.map_width) - ((*b)->info.map_height) * ((*b)->info.map_width);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   178
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   179
		if (r == 0) r = (*a)->info.map_width - (*b)->info.map_width;
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   180
		return (r != 0) ? r : NGameClientSorter(a, b);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   181
	}
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   182
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   183
	/** Sort servers by current date */
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   184
	static int CDECL NGameDateSorter(NetworkGameList* const *a, NetworkGameList* const *b)
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   185
	{
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   186
		int r = (*a)->info.game_date - (*b)->info.game_date;
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   187
		return (r != 0) ? r : NGameClientSorter(a, b);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   188
	}
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   189
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   190
	/** Sort servers by the number of days the game is running */
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   191
	static int CDECL NGameYearsSorter(NetworkGameList* const *a, NetworkGameList* const *b)
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   192
	{
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   193
		int r = (*a)->info.game_date - (*a)->info.start_date - (*b)->info.game_date + (*b)->info.start_date;
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   194
		return (r != 0) ? r : NGameDateSorter(a, b);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   195
	}
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   196
9414
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   197
	/** Sort servers by joinability. If both servers are the
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   198
	 * same, prefer the non-passworded server first. */
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   199
	static int CDECL NGameAllowedSorter(NetworkGameList* const *a, NetworkGameList* const *b)
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   200
	{
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   201
		/* The servers we do not know anything about (the ones that did not reply) should be at the bottom) */
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   202
		int r = StrEmpty((*a)->info.server_revision) - StrEmpty((*b)->info.server_revision);
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   203
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   204
		/* Reverse default as we are interested in version-compatible clients first */
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   205
		if (r == 0) r = (*b)->info.version_compatible - (*a)->info.version_compatible;
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   206
		/* The version-compatible ones are then sorted with NewGRF compatible first, incompatible last */
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   207
		if (r == 0) r = (*b)->info.compatible - (*a)->info.compatible;
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   208
		/* Passworded servers should be below unpassworded servers */
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   209
		if (r == 0) r = (*a)->info.use_password - (*b)->info.use_password;
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   210
		/* Finally sort on the name of the server */
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   211
		if (r == 0) r = NGameNameSorter(a, b);
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   212
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   213
		return r;
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   214
	}
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   215
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   216
	/** Sort the server list */
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   217
	void SortNetworkGameList()
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   218
	{
9414
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   219
		if (!this->servers.Sort()) return;
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   220
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   221
		/* After sorting ngl->sort_list contains the sorted items. Put these back
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   222
		 * into the original list. Basically nothing has changed, we are only
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   223
		 * shuffling the ->next pointers */
9365
95e9cbc0257e (svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents: 9354
diff changeset
   224
		_network_game_list = this->servers[0];
9414
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   225
		NetworkGameList *item = _network_game_list;
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   226
		for (uint i = 1; i != this->servers.Length(); i++) {
9365
95e9cbc0257e (svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents: 9354
diff changeset
   227
			item->next = this->servers[i];
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   228
			item = item->next;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   229
		}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   230
		item->next = NULL;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   231
	}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   232
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   233
	/**
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   234
	 * Draw a single server line.
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   235
	 * @param cur_item  the server to draw.
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   236
	 * @param y         from where to draw?
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   237
	 * @param highlight does the line need to be highlighted?
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   238
	 */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   239
	void DrawServerLine(const NetworkGameList *cur_item, uint y, bool highlight)
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   240
	{
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   241
		/* show highlighted item with a different colour */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   242
		if (highlight) GfxFillRect(this->widget[NGWW_NAME].left + 1, y - 2, this->widget[NGWW_INFO].right - 1, y + 9, 10);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   243
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   244
		SetDParamStr(0, cur_item->info.server_name);
9648
c79160082c0f (svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents: 9481
diff changeset
   245
		DrawStringTruncated(this->widget[NGWW_NAME].left + 5, y, STR_JUST_RAW_STRING, TC_BLACK, this->widget[NGWW_NAME].right - this->widget[NGWW_NAME].left - 5);
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   246
9660
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   247
		/* only draw details if the server is online */
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   248
		if (cur_item->online) {
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   249
			SetDParam(0, cur_item->info.clients_on);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   250
			SetDParam(1, cur_item->info.clients_max);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   251
			SetDParam(2, cur_item->info.companies_on);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   252
			SetDParam(3, cur_item->info.companies_max);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   253
			DrawStringCentered(this->widget[NGWW_CLIENTS].left + 39, y, STR_NETWORK_GENERAL_ONLINE, TC_GOLD);
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   254
9660
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   255
			/* map size */
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   256
			if (!this->IsWidgetHidden(NGWW_MAPSIZE)) {
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   257
				SetDParam(0, cur_item->info.map_width);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   258
				SetDParam(1, cur_item->info.map_height);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   259
				DrawStringCentered(this->widget[NGWW_MAPSIZE].left + 39, y, STR_NETWORK_MAP_SIZE_SHORT, TC_BLACK);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   260
			}
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   261
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   262
			/* current date */
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   263
			if (!this->IsWidgetHidden(NGWW_DATE)) {
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   264
				YearMonthDay ymd;
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   265
				ConvertDateToYMD(cur_item->info.game_date, &ymd);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   266
				SetDParam(0, ymd.year);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   267
				DrawStringCentered(this->widget[NGWW_DATE].left + 29, y, STR_JUST_INT, TC_BLACK);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   268
			}
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   269
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   270
			/* number of years the game is running */
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   271
			if (!this->IsWidgetHidden(NGWW_YEARS)) {
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   272
				YearMonthDay ymd_cur, ymd_start;
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   273
				ConvertDateToYMD(cur_item->info.game_date, &ymd_cur);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   274
				ConvertDateToYMD(cur_item->info.start_date, &ymd_start);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   275
				SetDParam(0, ymd_cur.year - ymd_start.year);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   276
				DrawStringCentered(this->widget[NGWW_YEARS].left + 29, y, STR_JUST_INT, TC_BLACK);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   277
			}
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   278
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   279
			/* draw a lock if the server is password protected */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   280
			if (cur_item->info.use_password) DrawSprite(SPR_LOCK, PAL_NONE, this->widget[NGWW_INFO].left + 5, y - 1);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   281
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   282
			/* draw red or green icon, depending on compatibility with server */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   283
			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);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   284
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   285
			/* draw flag according to server language */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   286
			DrawSprite(SPR_FLAGS_BASE + cur_item->info.server_lang, PAL_NONE, this->widget[NGWW_INFO].left + 25, y);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   287
		}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   288
	}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   289
9414
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   290
public:
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   291
	NetworkGameWindow(const WindowDesc *desc) : QueryStringBaseWindow(desc)
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   292
	{
9420
8a38703928e8 (svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents: 9416
diff changeset
   293
		ttd_strlcpy(this->edit_str_buf, _settings_client.network.player_name, lengthof(this->edit_str_buf));
9414
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   294
		this->afilter = CS_ALPHANUMERAL;
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   295
		InitializeTextBuffer(&this->text, this->edit_str_buf, lengthof(this->edit_str_buf), 120);
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   296
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   297
		UpdateNetworkGameWindow(true);
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   298
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   299
		this->vscroll.cap = 11;
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   300
		this->resize.step_height = NET_PRC__SIZE_OF_ROW;
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   301
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   302
		this->field = NGWW_PLAYER;
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   303
		this->server = NULL;
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   304
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   305
		this->servers.SetListing(this->last_sorting);
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   306
		this->servers.SetSortFuncs(this->sorter_funcs);
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   307
		this->servers.ForceRebuild();
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   308
		this->SortNetworkGameList();
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   309
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   310
		this->FindWindowPlacementAndResize(desc);
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   311
	}
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   312
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   313
	~NetworkGameWindow()
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   314
	{
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   315
		this->last_sorting = this->servers.GetListing();
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   316
	}
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   317
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   318
	virtual void OnPaint()
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   319
	{
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   320
		const NetworkGameList *sel = this->server;
9414
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   321
		const SortButtonState arrow = this->servers.IsDescSortOrder() ? SBS_DOWN : SBS_UP;
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   322
9414
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   323
		if (this->servers.NeedRebuild()) {
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   324
			this->BuildNetworkGameList();
9365
95e9cbc0257e (svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents: 9354
diff changeset
   325
			SetVScrollCount(this, this->servers.Length());
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   326
		}
9414
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   327
		this->SortNetworkGameList();
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   328
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   329
		/* 'Refresh' button invisible if no server selected */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   330
		this->SetWidgetDisabledState(NGWW_REFRESH, sel == NULL);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   331
		/* 'Join' button disabling conditions */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   332
		this->SetWidgetDisabledState(NGWW_JOIN, sel == NULL || // no Selected Server
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   333
				!sel->online || // Server offline
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   334
				sel->info.clients_on >= sel->info.clients_max || // Server full
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   335
				!sel->info.compatible); // Revision mismatch
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   336
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   337
		/* 'NewGRF Settings' button invisible if no NewGRF is used */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   338
		this->SetWidgetHiddenState(NGWW_NEWGRF, sel == NULL ||
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   339
				!sel->online ||
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   340
				sel->info.grfconfig == NULL);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   341
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   342
		SetDParam(0, 0x00);
9420
8a38703928e8 (svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents: 9416
diff changeset
   343
		SetDParam(1, _lan_internet_types_dropdown[_settings_client.network.lan_internet]);
9273
35e0224ea8f1 (svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents: 9269
diff changeset
   344
		this->DrawWidgets();
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   345
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   346
		/* Edit box to set player name */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   347
		this->DrawEditBox(NGWW_PLAYER);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   348
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   349
		DrawString(this->widget[NGWW_PLAYER].left - 100, 23, STR_NETWORK_PLAYER_NAME, TC_GOLD);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   350
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   351
		/* Sort based on widgets: name, clients, compatibility */
9414
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   352
		switch (this->servers.SortType()) {
9273
35e0224ea8f1 (svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents: 9269
diff changeset
   353
			case NGWW_NAME    - NGWW_NAME: this->DrawSortButtonState(NGWW_NAME,    arrow); break;
35e0224ea8f1 (svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents: 9269
diff changeset
   354
			case NGWW_CLIENTS - NGWW_NAME: this->DrawSortButtonState(NGWW_CLIENTS, arrow); break;
9660
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   355
			case NGWW_MAPSIZE - NGWW_NAME: if (!this->IsWidgetHidden(NGWW_MAPSIZE)) this->DrawSortButtonState(NGWW_MAPSIZE, arrow); break;
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   356
			case NGWW_DATE    - NGWW_NAME: if (!this->IsWidgetHidden(NGWW_DATE))    this->DrawSortButtonState(NGWW_DATE,    arrow); break;
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   357
			case NGWW_YEARS   - NGWW_NAME: if (!this->IsWidgetHidden(NGWW_YEARS))   this->DrawSortButtonState(NGWW_YEARS,   arrow); break;
9273
35e0224ea8f1 (svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents: 9269
diff changeset
   358
			case NGWW_INFO    - NGWW_NAME: this->DrawSortButtonState(NGWW_INFO,    arrow); break;
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   359
		}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   360
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   361
		uint16 y = NET_PRC__OFFSET_TOP_WIDGET + 3;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   362
9462
8c8bcb29604d (svn r13380) -Fix (r13327): MSVC signed/unsigned warning
glx
parents: 9451
diff changeset
   363
		const int max = min(this->vscroll.pos + this->vscroll.cap, (int)this->servers.Length());
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   364
9414
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   365
		for (int i = this->vscroll.pos; i < max; ++i) {
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   366
			const NetworkGameList *ngl = this->servers[i];
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   367
			this->DrawServerLine(ngl, y, ngl == sel);
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   368
			y += NET_PRC__SIZE_OF_ROW;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   369
		}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   370
9420
8a38703928e8 (svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents: 9416
diff changeset
   371
		const NetworkGameList *last_joined = NetworkGameListAddItem(inet_addr(_settings_client.network.last_host), _settings_client.network.last_port);
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   372
		/* Draw the last joined server, if any */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   373
		if (last_joined != NULL) this->DrawServerLine(last_joined, y = this->widget[NGWW_LASTJOINED].top + 3, last_joined == sel);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   374
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   375
		/* Draw the right menu */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   376
		GfxFillRect(this->widget[NGWW_DETAILS].left + 1, 43, this->widget[NGWW_DETAILS].right - 1, 92, 157);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   377
		if (sel == NULL) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   378
			DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, 58, STR_NETWORK_GAME_INFO, TC_FROMSTRING);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   379
		} else if (!sel->online) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   380
			SetDParamStr(0, sel->info.server_name);
9648
c79160082c0f (svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents: 9481
diff changeset
   381
			DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, 68, STR_JUST_RAW_STRING, TC_ORANGE); // game name
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   382
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   383
			DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, 132, STR_NETWORK_SERVER_OFFLINE, TC_FROMSTRING); // server offline
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   384
		} else { // show game info
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   385
			uint16 y = 100;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   386
			const uint16 x = this->widget[NGWW_DETAILS].left + 5;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   387
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   388
			DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, 48, STR_NETWORK_GAME_INFO, TC_FROMSTRING);
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   389
2055
4926ed1a7562 (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
   390
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   391
			SetDParamStr(0, sel->info.server_name);
9648
c79160082c0f (svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents: 9481
diff changeset
   392
			DrawStringCenteredTruncated(this->widget[NGWW_DETAILS].left, this->widget[NGWW_DETAILS].right, 62, STR_JUST_RAW_STRING, TC_ORANGE); // game name
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
   393
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   394
			SetDParamStr(0, sel->info.map_name);
9648
c79160082c0f (svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents: 9481
diff changeset
   395
			DrawStringCenteredTruncated(this->widget[NGWW_DETAILS].left, this->widget[NGWW_DETAILS].right, 74, STR_JUST_RAW_STRING, TC_BLACK); // map name
8937
9a4da442dd50 (svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium
parents: 8931
diff changeset
   396
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   397
			SetDParam(0, sel->info.clients_on);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   398
			SetDParam(1, sel->info.clients_max);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   399
			SetDParam(2, sel->info.companies_on);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   400
			SetDParam(3, sel->info.companies_max);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   401
			DrawString(x, y, STR_NETWORK_CLIENTS, TC_GOLD);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   402
			y += 10;
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
   403
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   404
			SetDParam(0, STR_NETWORK_LANG_ANY + sel->info.server_lang);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   405
			DrawString(x, y, STR_NETWORK_LANGUAGE, TC_GOLD); // server language
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   406
			y += 10;
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
   407
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   408
			SetDParam(0, STR_TEMPERATE_LANDSCAPE + sel->info.map_set);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   409
			DrawString(x, y, STR_NETWORK_TILESET, TC_GOLD); // tileset
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   410
			y += 10;
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
   411
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   412
			SetDParam(0, sel->info.map_width);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   413
			SetDParam(1, sel->info.map_height);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   414
			DrawString(x, y, STR_NETWORK_MAP_SIZE, TC_GOLD); // map size
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   415
			y += 10;
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
   416
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   417
			SetDParamStr(0, sel->info.server_revision);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   418
			DrawString(x, y, STR_NETWORK_SERVER_VERSION, TC_GOLD); // server version
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   419
			y += 10;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   420
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   421
			SetDParamStr(0, sel->info.hostname);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   422
			SetDParam(1, sel->port);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   423
			DrawString(x, y, STR_NETWORK_SERVER_ADDRESS, TC_GOLD); // server address
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   424
			y += 10;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   425
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   426
			SetDParam(0, sel->info.start_date);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   427
			DrawString(x, y, STR_NETWORK_START_DATE, TC_GOLD); // start date
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   428
			y += 10;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   429
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   430
			SetDParam(0, sel->info.game_date);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   431
			DrawString(x, y, STR_NETWORK_CURRENT_DATE, TC_GOLD); // current date
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   432
			y += 10;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   433
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   434
			y += 2;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   435
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   436
			if (!sel->info.compatible) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   437
				DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, y, sel->info.version_compatible ? STR_NETWORK_GRF_MISMATCH : STR_NETWORK_VERSION_MISMATCH, TC_FROMSTRING); // server mismatch
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   438
			} else if (sel->info.clients_on == sel->info.clients_max) {
9451
0d6806ba5504 (svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents: 9441
diff changeset
   439
				/* Show: server full, when clients_on == max_clients */
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   440
				DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, y, STR_NETWORK_SERVER_FULL, TC_FROMSTRING); // server full
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   441
			} else if (sel->info.use_password) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   442
				DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, y, STR_NETWORK_PASSWORD, TC_FROMSTRING); // password warning
2639
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2630
diff changeset
   443
			}
659
a9733f856cd0 (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
   444
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   445
			y += 10;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   446
		}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   447
	}
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   448
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   449
	virtual void OnClick(Point pt, int widget)
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   450
	{
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   451
		this->field = widget;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   452
		switch (widget) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   453
			case NGWW_PLAYER:
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   454
				ShowOnScreenKeyboard(this, NGWW_PLAYER, 0, 0);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   455
				break;
741
422ce499322b (svn r1197) -Fix: [GUI] in r1194 someone deleted too much code from WE_KEYPRESS. Now
truelight
parents: 738
diff changeset
   456
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   457
			case NGWW_CANCEL: // Cancel button
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   458
				DeleteWindowById(WC_NETWORK_WINDOW, 0);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   459
				break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   460
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   461
			case NGWW_CONN_BTN: // 'Connection' droplist
9420
8a38703928e8 (svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents: 9416
diff changeset
   462
				ShowDropDownMenu(this, _lan_internet_types_dropdown, _settings_client.network.lan_internet, NGWW_CONN_BTN, 0, 0); // do it for widget NSSW_CONN_BTN
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   463
				break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   464
9660
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   465
			case NGWW_NAME:    // Sort by name
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   466
			case NGWW_CLIENTS: // Sort by connected clients
9660
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   467
			case NGWW_MAPSIZE: // Sort by map size
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   468
			case NGWW_DATE:    // Sort by date
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   469
			case NGWW_YEARS:   // Sort by years
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   470
			case NGWW_INFO:    // Connectivity (green dot)
9414
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   471
				if (this->servers.SortType() == widget - NGWW_NAME) {
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   472
					this->servers.ToggleSortOrder();
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   473
				} else {
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   474
					this->servers.SetSortType(widget - NGWW_NAME);
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   475
					this->servers.ForceResort();
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   476
				}
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   477
				this->SetDirty();
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   478
				break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   479
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   480
			case NGWW_MATRIX: { // Matrix to show networkgames
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   481
				uint32 id_v = (pt.y - NET_PRC__OFFSET_TOP_WIDGET) / NET_PRC__SIZE_OF_ROW;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   482
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   483
				if (id_v >= this->vscroll.cap) return; // click out of bounds
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   484
				id_v += this->vscroll.pos;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   485
9415
565481e82c56 (svn r13328) -Fix (r13327): Don't access an item when there isn't any
skidd13
parents: 9414
diff changeset
   486
				this->server = (id_v < this->servers.Length()) ? this->servers[id_v] : NULL;
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   487
				this->SetDirty();
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   488
			} break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   489
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   490
			case NGWW_LASTJOINED: {
9420
8a38703928e8 (svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents: 9416
diff changeset
   491
				NetworkGameList *last_joined = NetworkGameListAddItem(inet_addr(_settings_client.network.last_host), _settings_client.network.last_port);
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   492
				if (last_joined != NULL) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   493
					this->server = last_joined;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   494
					this->SetDirty();
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   495
				}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   496
			} break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   497
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   498
			case NGWW_FIND: // Find server automatically
9420
8a38703928e8 (svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents: 9416
diff changeset
   499
				switch (_settings_client.network.lan_internet) {
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   500
					case 0: NetworkUDPSearchGame(); break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   501
					case 1: NetworkUDPQueryMasterServer(); break;
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
   502
				}
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
   503
				break;
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
   504
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   505
			case NGWW_ADD: // Add a server
9648
c79160082c0f (svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents: 9481
diff changeset
   506
				SetDParamStr(0, _settings_client.network.connect_to_ip);
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   507
				ShowQueryString(
9648
c79160082c0f (svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents: 9481
diff changeset
   508
					STR_JUST_RAW_STRING,
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   509
					STR_NETWORK_ENTER_IP,
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   510
					31 | 0x1000,  // maximum number of characters OR
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   511
					250, // characters up to this width pixels, whichever is satisfied first
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   512
					this, CS_ALPHANUMERAL);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   513
				break;
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
   514
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   515
			case NGWW_START: // Start server
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   516
				ShowNetworkStartServerWindow();
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   517
				break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   518
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   519
			case NGWW_JOIN: // Join Game
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   520
				if (this->server != NULL) {
9420
8a38703928e8 (svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents: 9416
diff changeset
   521
					snprintf(_settings_client.network.last_host, sizeof(_settings_client.network.last_host), "%s", inet_ntoa(*(struct in_addr *)&this->server->ip));
8a38703928e8 (svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents: 9416
diff changeset
   522
					_settings_client.network.last_port = this->server->port;
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   523
					ShowNetworkLobbyWindow(this->server);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   524
				}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   525
				break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   526
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   527
			case NGWW_REFRESH: // Refresh
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   528
				if (this->server != NULL) NetworkUDPQueryServer(this->server->info.hostname, this->server->port);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   529
				break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   530
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   531
			case NGWW_NEWGRF: // NewGRF Settings
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   532
				if (this->server != NULL) ShowNewGRFSettings(false, false, false, &this->server->info.grfconfig);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   533
				break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   534
		}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   535
	}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   536
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   537
	virtual void OnDropdownSelect(int widget, int index)
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   538
	{
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   539
		switch (widget) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   540
			case NGWW_CONN_BTN:
9420
8a38703928e8 (svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents: 9416
diff changeset
   541
				_settings_client.network.lan_internet = index;
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   542
				break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   543
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   544
			default:
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   545
				NOT_REACHED();
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   546
		}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   547
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   548
		this->SetDirty();
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   549
	}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   550
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   551
	virtual void OnMouseLoop()
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   552
	{
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   553
		if (this->field == NGWW_PLAYER) this->HandleEditBox(NGWW_PLAYER);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   554
	}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   555
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   556
	virtual void OnInvalidateData(int data)
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   557
	{
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   558
		if (data != 0) this->server = NULL;
9414
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   559
		this->servers.ForceRebuild();
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   560
		this->SetDirty();
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   561
	}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   562
9285
235e5e2d7f55 (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: 9274
diff changeset
   563
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   564
	{
9285
235e5e2d7f55 (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: 9274
diff changeset
   565
		EventState state = ES_NOT_HANDLED;
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   566
		if (this->field != NGWW_PLAYER) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   567
			if (this->server != NULL) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   568
				if (keycode == WKC_DELETE) { // Press 'delete' to remove servers
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   569
					NetworkGameListRemoveItem(this->server);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   570
					NetworkRebuildHostList();
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   571
					this->server = NULL;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   572
				}
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
   573
			}
9285
235e5e2d7f55 (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: 9274
diff changeset
   574
			return state;
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   575
		}
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
   576
9416
a6f2e6a99ed5 (svn r13330) -Fix: 'Player name' dialog was broken in two ways
smatz
parents: 9415
diff changeset
   577
		if (this->HandleEditBoxKey(NGWW_PLAYER, key, keycode, state) == 1) return state; // enter pressed
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   578
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   579
		/* The name is only allowed when it starts with a letter! */
9416
a6f2e6a99ed5 (svn r13330) -Fix: 'Player name' dialog was broken in two ways
smatz
parents: 9415
diff changeset
   580
		if (!StrEmpty(this->edit_str_buf) && this->edit_str_buf[0] != ' ') {
9420
8a38703928e8 (svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents: 9416
diff changeset
   581
			ttd_strlcpy(_settings_client.network.player_name, this->edit_str_buf, lengthof(_settings_client.network.player_name));
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   582
		} else {
9420
8a38703928e8 (svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents: 9416
diff changeset
   583
			ttd_strlcpy(_settings_client.network.player_name, "Player", lengthof(_settings_client.network.player_name));
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   584
		}
9285
235e5e2d7f55 (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: 9274
diff changeset
   585
		return state;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   586
	}
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   587
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   588
	virtual void OnQueryTextFinished(char *str)
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   589
	{
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   590
		if (!StrEmpty(str)) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   591
			NetworkAddServer(str);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   592
			NetworkRebuildHostList();
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   593
		}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   594
	}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   595
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   596
	virtual void OnResize(Point new_size, Point delta)
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   597
	{
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   598
		this->vscroll.cap += delta.y / (int)this->resize.step_height;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   599
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   600
		this->widget[NGWW_MATRIX].data = (this->vscroll.cap << 8) + 1;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   601
9365
95e9cbc0257e (svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents: 9354
diff changeset
   602
		SetVScrollCount(this, this->servers.Length());
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   603
9660
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   604
		/* Additional colums in server list */
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   605
		if (this->width > NetworkGameWindow::MIN_EXTRA_COLUMNS_WIDTH + GetWidgetWidth(NGWW_MAPSIZE)
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   606
				+ GetWidgetWidth(NGWW_DATE) + GetWidgetWidth(NGWW_YEARS)) {
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   607
			/* show columns 'Map size', 'Date' and 'Years' */
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   608
			this->SetWidgetsHiddenState(false, NGWW_MAPSIZE, NGWW_DATE, NGWW_YEARS, WIDGET_LIST_END);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   609
			AlignWidgetRight(NGWW_YEARS,   NGWW_INFO);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   610
			AlignWidgetRight(NGWW_DATE,    NGWW_YEARS);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   611
			AlignWidgetRight(NGWW_MAPSIZE, NGWW_DATE);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   612
			AlignWidgetRight(NGWW_CLIENTS, NGWW_MAPSIZE);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   613
		} else if (this->width > NetworkGameWindow::MIN_EXTRA_COLUMNS_WIDTH + GetWidgetWidth(NGWW_MAPSIZE) + GetWidgetWidth(NGWW_DATE)) {
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   614
			/* show columns 'Map size' and 'Date' */
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   615
			this->SetWidgetsHiddenState(false, NGWW_MAPSIZE, NGWW_DATE, WIDGET_LIST_END);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   616
			this->HideWidget(NGWW_YEARS);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   617
			AlignWidgetRight(NGWW_DATE,    NGWW_INFO);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   618
			AlignWidgetRight(NGWW_MAPSIZE, NGWW_DATE);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   619
			AlignWidgetRight(NGWW_CLIENTS, NGWW_MAPSIZE);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   620
		} else if (this->width > NetworkGameWindow::MIN_EXTRA_COLUMNS_WIDTH + GetWidgetWidth(NGWW_MAPSIZE)) {
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   621
			/* show column 'Map size' */
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   622
			this->ShowWidget(NGWW_MAPSIZE);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   623
			this->SetWidgetsHiddenState(true, NGWW_DATE, NGWW_YEARS, WIDGET_LIST_END);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   624
			AlignWidgetRight(NGWW_MAPSIZE, NGWW_INFO);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   625
			AlignWidgetRight(NGWW_CLIENTS, NGWW_MAPSIZE);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   626
		} else {
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   627
			/* hide columns 'Map size', 'Date' and 'Years' */
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   628
			this->SetWidgetsHiddenState(true, NGWW_MAPSIZE, NGWW_DATE, NGWW_YEARS, WIDGET_LIST_END);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   629
			AlignWidgetRight(NGWW_CLIENTS, NGWW_INFO);
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   630
		}
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   631
		this->widget[NGWW_NAME].right = this->widget[NGWW_CLIENTS].left - 1;
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   632
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   633
		/* BOTTOM */
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   634
		int widget_width = this->widget[NGWW_FIND].right - this->widget[NGWW_FIND].left;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   635
		int space = (this->width - 4 * widget_width - 25) / 3;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   636
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   637
		int offset = 10;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   638
		for (uint i = 0; i < 4; i++) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   639
			this->widget[NGWW_FIND + i].left  = offset;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   640
			offset += widget_width;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   641
			this->widget[NGWW_FIND + i].right = offset;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   642
			offset += space;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   643
		}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   644
	}
9660
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   645
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   646
	static const int MIN_EXTRA_COLUMNS_WIDTH = 550;   ///< default width of the window
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   647
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   648
9660
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   649
Listing NetworkGameWindow::last_sorting = {false, 5};
9414
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   650
GUIGameServerList::SortFunction *const NetworkGameWindow::sorter_funcs[] = {
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   651
	&NGameNameSorter,
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   652
	&NGameClientSorter,
9660
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   653
	&NGameMapSizeSorter,
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   654
	&NGameDateSorter,
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   655
	&NGameYearsSorter,
9414
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   656
	&NGameAllowedSorter
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   657
};
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   658
d2374f994ac9 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents: 9413
diff changeset
   659
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   660
static const Widget _network_game_window_widgets[] = {
7960
b88d72baa45b (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 7959
diff changeset
   661
/* TOP */
9827
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   662
{   WWT_CLOSEBOX,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,     0,    10,     0,    13, STR_00C5,                         STR_018B_CLOSE_WINDOW},            // NGWW_CLOSE
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   663
{    WWT_CAPTION,   RESIZE_RIGHT,  COLOUR_LIGHT_BLUE,    11,   449,     0,    13, STR_NETWORK_MULTIPLAYER,          STR_NULL},                         // NGWW_CAPTION
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   664
{      WWT_PANEL,   RESIZE_RB,     COLOUR_LIGHT_BLUE,     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
   665
9827
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   666
{       WWT_TEXT,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,     9,    85,    23,    35, STR_NETWORK_CONNECTION,           STR_NULL},                         // NGWW_CONNECTION
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   667
{ WWT_DROPDOWNIN,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,    90,   181,    22,    33, STR_NETWORK_LAN_INTERNET_COMBO,   STR_NETWORK_CONNECTION_TIP},       // NGWW_CONN_BTN
2881
ade9a553be53 (svn r3429) - Feature (Followup): Change the gamelist window to accomodate for the new information.
Darkvater
parents: 2879
diff changeset
   668
9827
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   669
{    WWT_EDITBOX,   RESIZE_LR,     COLOUR_LIGHT_BLUE,   290,   440,    22,    33, STR_NETWORK_PLAYER_NAME_OSKTITLE, STR_NETWORK_ENTER_NAME_TIP},       // NGWW_PLAYER
4344
7e123fec5b0b (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
   670
7960
b88d72baa45b (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 7959
diff changeset
   671
/* LEFT SIDE */
9827
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   672
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   COLOUR_WHITE,         10,    70,    42,    53, STR_NETWORK_GAME_NAME,            STR_NETWORK_GAME_NAME_TIP},        // NGWW_NAME
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   673
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   COLOUR_WHITE,         71,   150,    42,    53, STR_NETWORK_CLIENTS_CAPTION,      STR_NETWORK_CLIENTS_CAPTION_TIP},  // NGWW_CLIENTS
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   674
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   COLOUR_WHITE,         71,   150,    42,    53, STR_NETWORK_MAP_SIZE_CAPTION,     STR_NETWORK_MAP_SIZE_CAPTION_TIP}, // NGWW_MAPSIZE
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   675
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   COLOUR_WHITE,         71,   130,    42,    53, STR_NETWORK_DATE_CAPTION,         STR_NETWORK_DATE_CAPTION_TIP},     // NGWW_DATE
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   676
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   COLOUR_WHITE,         71,   130,    42,    53, STR_NETWORK_YEARS_CAPTION,        STR_NETWORK_YEARS_CAPTION_TIP},    // NGWW_YEARS
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   677
{ WWT_PUSHTXTBTN,   RESIZE_LR,     COLOUR_WHITE,        151,   190,    42,    53, STR_EMPTY,                        STR_NETWORK_INFO_ICONS_TIP},       // NGWW_INFO
7439
dfbe1adff313 (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: 7363
diff changeset
   678
9827
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   679
{     WWT_MATRIX,   RESIZE_RB,     COLOUR_LIGHT_BLUE,    10,   190,    54,   208, (11 << 8) + 1,                    STR_NETWORK_CLICK_GAME_TO_SELECT}, // NGWW_MATRIX
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   680
{  WWT_SCROLLBAR,   RESIZE_LRB,    COLOUR_LIGHT_BLUE,   191,   202,    42,   208, 0x0,                              STR_0190_SCROLL_BAR_SCROLLS_LIST}, // NGWW_SCROLLBAR
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   681
{       WWT_TEXT,   RESIZE_RTB,    COLOUR_LIGHT_BLUE,    10,   190,   211,   222, STR_NETWORK_LAST_JOINED_SERVER,   STR_NULL},                         // NGWW_LASTJOINED_LABEL
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   682
{      WWT_PANEL,   RESIZE_RTB,    COLOUR_LIGHT_BLUE,    10,   190,   223,   236, 0x0,                              STR_NETWORK_CLICK_TO_SELECT_LAST}, // NGWW_LASTJOINED
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   683
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   684
/* RIGHT SIDE */
9827
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   685
{      WWT_PANEL,   RESIZE_LRB,    COLOUR_LIGHT_BLUE,   210,   440,    42,   236, 0x0,                              STR_NULL},                         // NGWW_DETAILS
2881
ade9a553be53 (svn r3429) - Feature (Followup): Change the gamelist window to accomodate for the new information.
Darkvater
parents: 2879
diff changeset
   686
9827
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   687
{ WWT_PUSHTXTBTN,   RESIZE_LRTB,   COLOUR_WHITE,        215,   315,   215,   226, STR_NETWORK_JOIN_GAME,            STR_NULL},                         // NGWW_JOIN
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   688
{ WWT_PUSHTXTBTN,   RESIZE_LRTB,   COLOUR_WHITE,        330,   435,   215,   226, STR_NETWORK_REFRESH,              STR_NETWORK_REFRESH_TIP},          // NGWW_REFRESH
5339
96ac3f4933bb (svn r7505) -Feature: show NewGRFs used on a game server, show which NewGRFs you do and do not have.
rubidium
parents: 5247
diff changeset
   689
9827
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   690
{ WWT_PUSHTXTBTN,   RESIZE_LRTB,   COLOUR_WHITE,        330,   435,   197,   208, STR_NEWGRF_SETTINGS_BUTTON,       STR_NULL},                         // NGWW_NEWGRF
7343
9bf495fb4b10 (svn r10706) -Codechange: allow resizing the multiplayer server list window.
rubidium
parents: 7341
diff changeset
   691
7960
b88d72baa45b (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 7959
diff changeset
   692
/* BOTTOM */
9827
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   693
{ WWT_PUSHTXTBTN,   RESIZE_TB,     COLOUR_WHITE,         10,   110,   246,   257, STR_NETWORK_FIND_SERVER,          STR_NETWORK_FIND_SERVER_TIP},      // NGWW_FIND
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   694
{ WWT_PUSHTXTBTN,   RESIZE_TB,     COLOUR_WHITE,        118,   218,   246,   257, STR_NETWORK_ADD_SERVER,           STR_NETWORK_ADD_SERVER_TIP},       // NGWW_ADD
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   695
{ WWT_PUSHTXTBTN,   RESIZE_TB,     COLOUR_WHITE,        226,   326,   246,   257, STR_NETWORK_START_SERVER,         STR_NETWORK_START_SERVER_TIP},     // NGWW_START
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   696
{ WWT_PUSHTXTBTN,   RESIZE_TB,     COLOUR_WHITE,        334,   434,   246,   257, STR_012E_CANCEL,                  STR_NULL},                         // NGWW_CANCEL
7439
dfbe1adff313 (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: 7363
diff changeset
   697
9827
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   698
{  WWT_RESIZEBOX,   RESIZE_LRTB,   COLOUR_LIGHT_BLUE,   438,   449,   252,   263, 0x0,                              STR_RESIZE_BUTTON },
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   699
176
84990c4b9212 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents: 175
diff changeset
   700
{   WIDGETS_END},
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   701
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   702
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   703
static const WindowDesc _network_game_window_desc = {
9660
2bc15fc4dcf6 (svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium
parents: 9659
diff changeset
   704
	WDP_CENTER, WDP_CENTER, 450, 264, 780, 264,
5893
7e431a4abebb (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents: 5669
diff changeset
   705
	WC_NETWORK_WINDOW, WC_NONE,
7343
9bf495fb4b10 (svn r10706) -Codechange: allow resizing the multiplayer server list window.
rubidium
parents: 7341
diff changeset
   706
	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
   707
	_network_game_window_widgets,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   708
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   709
6247
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5916
diff changeset
   710
void ShowNetworkGameWindow()
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   711
{
2922
9eb5d9c8f78f (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
   712
	static bool first = true;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   713
	DeleteWindowById(WC_NETWORK_WINDOW, 0);
105
44e894da0fef (svn r106) New network core (by sign_de)
dominik
parents: 1
diff changeset
   714
764
7e1e17b7c7d4 (svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents: 749
diff changeset
   715
	/* Only show once */
2922
9eb5d9c8f78f (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
   716
	if (first) {
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
   717
		char * const *srv;
2881
ade9a553be53 (svn r3429) - Feature (Followup): Change the gamelist window to accomodate for the new information.
Darkvater
parents: 2879
diff changeset
   718
2922
9eb5d9c8f78f (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
   719
		first = false;
764
7e1e17b7c7d4 (svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents: 749
diff changeset
   720
		// add all servers from the config file to our list
2885
fc5297214b36 (svn r3435) - Fix a warning, removed unused extern and some comments in network_gamelist.c
Darkvater
parents: 2884
diff changeset
   721
		for (srv = &_network_host_list[0]; srv != endof(_network_host_list) && *srv != NULL; srv++) {
2881
ade9a553be53 (svn r3429) - Feature (Followup): Change the gamelist window to accomodate for the new information.
Darkvater
parents: 2879
diff changeset
   722
			NetworkAddServer(*srv);
764
7e1e17b7c7d4 (svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents: 749
diff changeset
   723
		}
7e1e17b7c7d4 (svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents: 749
diff changeset
   724
	}
7e1e17b7c7d4 (svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents: 749
diff changeset
   725
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   726
	new NetworkGameWindow(&_network_game_window_desc);
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   727
}
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   728
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   729
enum {
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   730
	NSSWND_START = 64,
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   731
	NSSWND_ROWSIZE = 12
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   732
};
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   733
7959
e0476faea1e2 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 7931
diff changeset
   734
/** Enum for NetworkStartServerWindow, referring to _network_start_server_window_widgets */
e0476faea1e2 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 7931
diff changeset
   735
enum NetworkStartServerWidgets {
e0476faea1e2 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 7931
diff changeset
   736
	NSSW_CLOSE           =  0,   ///< Close 'X' button
e0476faea1e2 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 7931
diff changeset
   737
	NSSW_GAMENAME        =  4,   ///< Background for editbox to set game name
e0476faea1e2 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 7931
diff changeset
   738
	NSSW_SETPWD          =  5,   ///< 'Set password' button
e0476faea1e2 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 7931
diff changeset
   739
	NSSW_SELMAP          =  7,   ///< 'Select map' list
8343
a6b70ddd862b (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents: 8284
diff changeset
   740
	NSSW_CONNTYPE_BTN    = 10,   ///< 'Connection type' droplist button
a6b70ddd862b (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents: 8284
diff changeset
   741
	NSSW_CLIENTS_BTND    = 12,   ///< 'Max clients' downarrow
a6b70ddd862b (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents: 8284
diff changeset
   742
	NSSW_CLIENTS_TXT     = 13,   ///< 'Max clients' text
a6b70ddd862b (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents: 8284
diff changeset
   743
	NSSW_CLIENTS_BTNU    = 14,   ///< 'Max clients' uparrow
a6b70ddd862b (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents: 8284
diff changeset
   744
	NSSW_COMPANIES_BTND  = 16,   ///< 'Max companies' downarrow
a6b70ddd862b (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents: 8284
diff changeset
   745
	NSSW_COMPANIES_TXT   = 17,   ///< 'Max companies' text
a6b70ddd862b (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents: 8284
diff changeset
   746
	NSSW_COMPANIES_BTNU  = 18,   ///< 'Max companies' uparrow
a6b70ddd862b (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents: 8284
diff changeset
   747
	NSSW_SPECTATORS_BTND = 20,   ///< 'Max spectators' downarrow
a6b70ddd862b (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents: 8284
diff changeset
   748
	NSSW_SPECTATORS_TXT  = 21,   ///< 'Max spectators' text
a6b70ddd862b (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents: 8284
diff changeset
   749
	NSSW_SPECTATORS_BTNU = 22,   ///< 'Max spectators' uparrow
a6b70ddd862b (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents: 8284
diff changeset
   750
	NSSW_LANGUAGE_BTN    = 24,   ///< 'Language spoken' droplist button
a6b70ddd862b (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents: 8284
diff changeset
   751
	NSSW_START           = 25,   ///< 'Start' button
a6b70ddd862b (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents: 8284
diff changeset
   752
	NSSW_LOAD            = 26,   ///< 'Load' button
a6b70ddd862b (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents: 8284
diff changeset
   753
	NSSW_CANCEL          = 27,   ///< 'Cancel' button
7959
e0476faea1e2 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 7931
diff changeset
   754
};
e0476faea1e2 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 7931
diff changeset
   755
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   756
struct NetworkStartServerWindow : public QueryStringBaseWindow {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   757
	byte field;                  ///< Selected text-field
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   758
	FiosItem *map;               ///< Selected map
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   759
	byte widget_id;              ///< The widget that has the pop-up input menu
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
   760
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   761
	NetworkStartServerWindow(const WindowDesc *desc) : QueryStringBaseWindow(desc)
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   762
	{
9420
8a38703928e8 (svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents: 9416
diff changeset
   763
		ttd_strlcpy(this->edit_str_buf, _settings_client.network.server_name, lengthof(this->edit_str_buf));
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
   764
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   765
		_saveload_mode = SLD_NEW_GAME;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   766
		BuildFileList();
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   767
		this->vscroll.cap = 12;
9690
6ce3777235e2 (svn r13796) -Fix [FS#2161]: one couldn't start the last scenario in the "start server window"'s list of scenarios.
rubidium
parents: 9660
diff changeset
   768
		this->vscroll.count = _fios_items.Length() + 1;
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
   769
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   770
		this->afilter = CS_ALPHANUMERAL;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   771
		InitializeTextBuffer(&this->text, this->edit_str_buf, lengthof(this->edit_str_buf), 160);
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
   772
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   773
		this->field = NSSW_GAMENAME;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   774
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   775
		this->FindWindowPlacementAndResize(desc);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   776
	}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   777
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   778
	virtual void OnPaint()
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   779
	{
9441
6f3d3595b42c (svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents: 9428
diff changeset
   780
		int y = NSSWND_START;
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   781
		const FiosItem *item;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   782
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   783
		/* draw basic widgets */
9481
25ed9b0c242a (svn r13433) -Codechange: remove a now useless global variable.
rubidium
parents: 9462
diff changeset
   784
		SetDParam(1, _connection_types_dropdown[_settings_client.network.server_advertise]);
9451
0d6806ba5504 (svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents: 9441
diff changeset
   785
		SetDParam(2, _settings_client.network.max_clients);
0d6806ba5504 (svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents: 9441
diff changeset
   786
		SetDParam(3, _settings_client.network.max_companies);
0d6806ba5504 (svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents: 9441
diff changeset
   787
		SetDParam(4, _settings_client.network.max_spectators);
0d6806ba5504 (svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents: 9441
diff changeset
   788
		SetDParam(5, STR_NETWORK_LANG_ANY + _settings_client.network.server_lang);
9273
35e0224ea8f1 (svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents: 9269
diff changeset
   789
		this->DrawWidgets();
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   790
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   791
		/* editbox to set game name */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   792
		this->DrawEditBox(NSSW_GAMENAME);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   793
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   794
		/* if password is set, draw red '*' next to 'Set password' button */
9451
0d6806ba5504 (svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents: 9441
diff changeset
   795
		if (!StrEmpty(_settings_client.network.server_password)) DoDrawString("*", 408, 23, TC_RED);
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   796
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   797
		/* draw list of maps */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   798
		GfxFillRect(11, 63, 258, 215, 0xD7);  // black background of maps list
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   799
9441
6f3d3595b42c (svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents: 9428
diff changeset
   800
		for (uint pos = this->vscroll.pos; pos < _fios_items.Length() + 1; pos++) {
6f3d3595b42c (svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents: 9428
diff changeset
   801
			item = _fios_items.Get(pos - 1);
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   802
			if (item == this->map || (pos == 0 && this->map == NULL))
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   803
				GfxFillRect(11, y - 1, 258, y + 10, 155); // show highlighted item with a different colour
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   804
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   805
			if (pos == 0) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   806
				DrawString(14, y, STR_4010_GENERATE_RANDOM_NEW_GAME, TC_DARK_GREEN);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   807
			} else {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   808
				DoDrawString(item->title, 14, y, _fios_colors[item->type] );
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
   809
			}
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   810
			y += NSSWND_ROWSIZE;
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
   811
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   812
			if (y >= this->vscroll.cap * NSSWND_ROWSIZE + NSSWND_START) break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   813
		}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   814
	}
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
   815
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   816
	virtual void OnClick(Point pt, int widget)
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   817
	{
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   818
		if (widget != NSSW_CONNTYPE_BTN && widget != NSSW_LANGUAGE_BTN) HideDropDownMenu(this);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   819
		this->field = widget;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   820
		switch (widget) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   821
			case NSSW_CLOSE:  // Close 'X'
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   822
			case NSSW_CANCEL: // Cancel button
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   823
				ShowNetworkGameWindow();
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   824
				break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   825
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   826
			case NSSW_GAMENAME:
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   827
				ShowOnScreenKeyboard(this, NSSW_GAMENAME, 0, 0);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   828
				break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   829
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   830
			case NSSW_SETPWD: // Set password button
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   831
				this->widget_id = NSSW_SETPWD;
9648
c79160082c0f (svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents: 9481
diff changeset
   832
				SetDParamStr(0, _settings_client.network.server_password);
c79160082c0f (svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents: 9481
diff changeset
   833
				ShowQueryString(STR_JUST_RAW_STRING, STR_NETWORK_SET_PASSWORD, 20, 250, this, CS_ALPHANUMERAL);
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   834
				break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   835
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   836
			case NSSW_SELMAP: { // Select map
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   837
				int y = (pt.y - NSSWND_START) / NSSWND_ROWSIZE;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   838
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   839
				y += this->vscroll.pos;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   840
				if (y >= this->vscroll.count) return;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   841
9441
6f3d3595b42c (svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents: 9428
diff changeset
   842
				this->map = (y == 0) ? NULL : _fios_items.Get(y - 1);
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   843
				this->SetDirty();
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   844
			} break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   845
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   846
			case NSSW_CONNTYPE_BTN: // Connection type
9481
25ed9b0c242a (svn r13433) -Codechange: remove a now useless global variable.
rubidium
parents: 9462
diff changeset
   847
				ShowDropDownMenu(this, _connection_types_dropdown, _settings_client.network.server_advertise, NSSW_CONNTYPE_BTN, 0, 0); // do it for widget NSSW_CONNTYPE_BTN
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   848
				break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   849
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   850
			case NSSW_CLIENTS_BTND:    case NSSW_CLIENTS_BTNU:    // Click on up/down button for number of clients
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   851
			case NSSW_COMPANIES_BTND:  case NSSW_COMPANIES_BTNU:  // Click on up/down button for number of companies
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   852
			case NSSW_SPECTATORS_BTND: case NSSW_SPECTATORS_BTNU: // Click on up/down button for number of spectators
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   853
				/* Don't allow too fast scrolling */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   854
				if ((this->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   855
					this->HandleButtonClick(widget);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   856
					this->SetDirty();
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   857
					switch (widget) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   858
						default: NOT_REACHED();
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   859
						case NSSW_CLIENTS_BTND: case NSSW_CLIENTS_BTNU:
9451
0d6806ba5504 (svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents: 9441
diff changeset
   860
							_settings_client.network.max_clients    = Clamp(_settings_client.network.max_clients    + widget - NSSW_CLIENTS_TXT,    2, MAX_CLIENTS);
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   861
							break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   862
						case NSSW_COMPANIES_BTND: case NSSW_COMPANIES_BTNU:
9451
0d6806ba5504 (svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents: 9441
diff changeset
   863
							_settings_client.network.max_companies  = Clamp(_settings_client.network.max_companies  + widget - NSSW_COMPANIES_TXT,  1, MAX_PLAYERS);
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   864
							break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   865
						case NSSW_SPECTATORS_BTND: case NSSW_SPECTATORS_BTNU:
9451
0d6806ba5504 (svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents: 9441
diff changeset
   866
							_settings_client.network.max_spectators = Clamp(_settings_client.network.max_spectators + widget - NSSW_SPECTATORS_TXT, 0, MAX_CLIENTS);
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   867
							break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   868
					}
7439
dfbe1adff313 (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: 7363
diff changeset
   869
				}
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   870
				_left_button_clicked = false;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   871
				break;
2887
810e555d5249 (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
   872
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   873
			case NSSW_CLIENTS_TXT:    // Click on number of players
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   874
				this->widget_id = NSSW_CLIENTS_TXT;
9451
0d6806ba5504 (svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents: 9441
diff changeset
   875
				SetDParam(0, _settings_client.network.max_clients);
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   876
				ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_NETWORK_NUMBER_OF_CLIENTS,    3, 50, this, CS_NUMERAL);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   877
				break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   878
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   879
			case NSSW_COMPANIES_TXT:  // Click on number of companies
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   880
				this->widget_id = NSSW_COMPANIES_TXT;
9451
0d6806ba5504 (svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents: 9441
diff changeset
   881
				SetDParam(0, _settings_client.network.max_companies);
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   882
				ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_NETWORK_NUMBER_OF_COMPANIES,  3, 50, this, CS_NUMERAL);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   883
				break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   884
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   885
			case NSSW_SPECTATORS_TXT: // Click on number of spectators
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   886
				this->widget_id = NSSW_SPECTATORS_TXT;
9451
0d6806ba5504 (svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents: 9441
diff changeset
   887
				SetDParam(0, _settings_client.network.max_spectators);
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   888
				ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_NETWORK_NUMBER_OF_SPECTATORS, 3, 50, this, CS_NUMERAL);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   889
				break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   890
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   891
			case NSSW_LANGUAGE_BTN: { // Language
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   892
				uint sel = 0;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   893
				for (uint i = 0; i < lengthof(_language_dropdown) - 1; i++) {
9451
0d6806ba5504 (svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents: 9441
diff changeset
   894
					if (_language_dropdown[i] == STR_NETWORK_LANG_ANY + _settings_client.network.server_lang) {
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   895
						sel = i;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   896
						break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   897
					}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   898
				}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   899
				ShowDropDownMenu(this, _language_dropdown, sel, NSSW_LANGUAGE_BTN, 0, 0);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   900
			} break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   901
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   902
			case NSSW_START: // Start game
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   903
				_is_network_server = true;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   904
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   905
				if (this->map == NULL) { // start random new game
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   906
					ShowGenerateLandscape();
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   907
				} else { // load a scenario
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   908
					char *name = FiosBrowseTo(this->map);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   909
					if (name != NULL) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   910
						SetFiosType(this->map->type);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   911
						_file_to_saveload.filetype = FT_SCENARIO;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   912
						ttd_strlcpy(_file_to_saveload.name, name, sizeof(_file_to_saveload.name));
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   913
						ttd_strlcpy(_file_to_saveload.title, this->map->title, sizeof(_file_to_saveload.title));
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   914
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   915
						delete this;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   916
						SwitchMode(SM_START_SCENARIO);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   917
					}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   918
				}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   919
				break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   920
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   921
			case NSSW_LOAD: // Load game
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   922
				_is_network_server = true;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   923
				/* XXX - WC_NETWORK_WINDOW (this window) should stay, but if it stays, it gets
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   924
				* copied all the elements of 'load game' and upon closing that, it segfaults */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   925
				delete this;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   926
				ShowSaveLoadDialog(SLD_LOAD_GAME);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   927
				break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   928
		}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   929
	}
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   930
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   931
	virtual void OnDropdownSelect(int widget, int index)
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   932
	{
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   933
		switch (widget) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   934
			case NSSW_CONNTYPE_BTN:
9481
25ed9b0c242a (svn r13433) -Codechange: remove a now useless global variable.
rubidium
parents: 9462
diff changeset
   935
				_settings_client.network.server_advertise = (index != 0);
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   936
				break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   937
			case NSSW_LANGUAGE_BTN:
9451
0d6806ba5504 (svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents: 9441
diff changeset
   938
				_settings_client.network.server_lang = _language_dropdown[index] - STR_NETWORK_LANG_ANY;
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   939
				break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   940
			default:
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   941
				NOT_REACHED();
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   942
		}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   943
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   944
		this->SetDirty();
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   945
	}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   946
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   947
	virtual void OnMouseLoop()
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   948
	{
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   949
		if (this->field == NSSW_GAMENAME) this->HandleEditBox(NSSW_GAMENAME);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   950
	}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   951
9285
235e5e2d7f55 (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: 9274
diff changeset
   952
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   953
	{
9285
235e5e2d7f55 (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: 9274
diff changeset
   954
		EventState state = ES_NOT_HANDLED;
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   955
		if (this->field == NSSW_GAMENAME) {
9285
235e5e2d7f55 (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: 9274
diff changeset
   956
			if (this->HandleEditBoxKey(NSSW_GAMENAME, key, keycode, state) == 1) return state; // enter pressed
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   957
9420
8a38703928e8 (svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents: 9416
diff changeset
   958
			ttd_strlcpy(_settings_client.network.server_name, this->text.buf, sizeof(_settings_client.network.server_name));
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   959
		}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   960
9285
235e5e2d7f55 (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: 9274
diff changeset
   961
		return state;
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   962
	}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   963
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   964
	virtual void OnQueryTextFinished(char *str)
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   965
	{
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   966
		if (str == NULL) return;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   967
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   968
		if (this->widget_id == NSSW_SETPWD) {
9420
8a38703928e8 (svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents: 9416
diff changeset
   969
			ttd_strlcpy(_settings_client.network.server_password, str, lengthof(_settings_client.network.server_password));
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   970
		} else {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   971
			int32 value = atoi(str);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   972
			this->InvalidateWidget(this->widget_id);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   973
			switch (this->widget_id) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   974
				default: NOT_REACHED();
9451
0d6806ba5504 (svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents: 9441
diff changeset
   975
				case NSSW_CLIENTS_TXT:    _settings_client.network.max_clients    = Clamp(value, 2, MAX_CLIENTS); break;
0d6806ba5504 (svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents: 9441
diff changeset
   976
				case NSSW_COMPANIES_TXT:  _settings_client.network.max_companies  = Clamp(value, 1, MAX_PLAYERS); break;
0d6806ba5504 (svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents: 9441
diff changeset
   977
				case NSSW_SPECTATORS_TXT: _settings_client.network.max_spectators = Clamp(value, 0, MAX_CLIENTS); break;
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   978
			}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   979
		}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   980
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   981
		this->SetDirty();
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   982
	}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
   983
};
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
static const Widget _network_start_server_window_widgets[] = {
7959
e0476faea1e2 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 7931
diff changeset
   986
/* Window decoration and background panel */
9827
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   987
{   WWT_CLOSEBOX,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,     0,    10,     0,    13, STR_00C5,                           STR_018B_CLOSE_WINDOW },               // NSSW_CLOSE
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   988
{    WWT_CAPTION,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,    11,   419,     0,    13, STR_NETWORK_START_GAME_WINDOW,      STR_NULL},
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   989
{      WWT_PANEL,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,     0,   419,    14,   243, 0x0,                                STR_NULL},
867
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 853
diff changeset
   990
7959
e0476faea1e2 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 7931
diff changeset
   991
/* Set game name and password widgets */
9827
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   992
{       WWT_TEXT,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,    10,    90,    22,    34, STR_NETWORK_NEW_GAME_NAME,          STR_NULL},
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   993
{    WWT_EDITBOX,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,   100,   272,    22,    33, STR_NETWORK_NEW_GAME_NAME_OSKTITLE, STR_NETWORK_NEW_GAME_NAME_TIP},        // NSSW_GAMENAME
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   994
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   COLOUR_WHITE,        285,   405,    22,    33, STR_NETWORK_SET_PASSWORD,           STR_NETWORK_PASSWORD_TIP},             // NSSW_SETPWD
867
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 853
diff changeset
   995
7959
e0476faea1e2 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 7931
diff changeset
   996
/* List of playable scenarios */
9827
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   997
{       WWT_TEXT,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,    10,   110,    43,    55, STR_NETWORK_SELECT_MAP,             STR_NULL},
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   998
{      WWT_INSET,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,    10,   271,    62,   216, STR_NULL,                           STR_NETWORK_SELECT_MAP_TIP},           // NSSW_SELMAP
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
   999
{  WWT_SCROLLBAR,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,   259,   270,    63,   215, 0x0,                                STR_0190_SCROLL_BAR_SCROLLS_LIST},
7959
e0476faea1e2 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 7931
diff changeset
  1000
7439
dfbe1adff313 (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: 7363
diff changeset
  1001
/* Combo/selection boxes to control Connection Type / Max Clients / Max Companies / Max Observers / Language */
9827
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1002
{       WWT_TEXT,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,   280,   419,    63,    75, STR_NETWORK_CONNECTION,             STR_NULL},
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1003
{ WWT_DROPDOWNIN,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,   280,   410,    77,    88, STR_NETWORK_LAN_INTERNET_COMBO,     STR_NETWORK_CONNECTION_TIP},           // NSSW_CONNTYPE_BTN
7959
e0476faea1e2 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 7931
diff changeset
  1004
9827
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1005
{       WWT_TEXT,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,   280,   419,    95,   107, STR_NETWORK_NUMBER_OF_CLIENTS,      STR_NULL},
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1006
{     WWT_IMGBTN,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,   280,   291,   109,   120, SPR_ARROW_DOWN,                     STR_NETWORK_NUMBER_OF_CLIENTS_TIP},    // NSSW_CLIENTS_BTND
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1007
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,   292,   397,   109,   120, STR_NETWORK_CLIENTS_SELECT,         STR_NETWORK_NUMBER_OF_CLIENTS_TIP},    // NSSW_CLIENTS_TXT
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1008
{     WWT_IMGBTN,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,   398,   410,   109,   120, SPR_ARROW_UP,                       STR_NETWORK_NUMBER_OF_CLIENTS_TIP},    // NSSW_CLIENTS_BTNU
7959
e0476faea1e2 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 7931
diff changeset
  1009
9827
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1010
{       WWT_TEXT,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,   280,   419,   127,   139, STR_NETWORK_NUMBER_OF_COMPANIES,    STR_NULL},
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1011
{     WWT_IMGBTN,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,   280,   291,   141,   152, SPR_ARROW_DOWN,                     STR_NETWORK_NUMBER_OF_COMPANIES_TIP},  // NSSW_COMPANIES_BTND
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1012
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,   292,   397,   141,   152, STR_NETWORK_COMPANIES_SELECT,       STR_NETWORK_NUMBER_OF_COMPANIES_TIP},  // NSSW_COMPANIES_TXT
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1013
{     WWT_IMGBTN,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,   398,   410,   141,   152, SPR_ARROW_UP,                       STR_NETWORK_NUMBER_OF_COMPANIES_TIP},  // NSSW_COMPANIES_BTNU
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1014
9827
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1015
{       WWT_TEXT,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,   280,   419,   159,   171, STR_NETWORK_NUMBER_OF_SPECTATORS,   STR_NULL},
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1016
{     WWT_IMGBTN,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,   280,   291,   173,   184, SPR_ARROW_DOWN,                     STR_NETWORK_NUMBER_OF_SPECTATORS_TIP}, // NSSW_SPECTATORS_BTND
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1017
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,   292,   397,   173,   184, STR_NETWORK_SPECTATORS_SELECT,      STR_NETWORK_NUMBER_OF_SPECTATORS_TIP}, // NSSW_SPECTATORS_TXT
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1018
{     WWT_IMGBTN,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,   398,   410,   173,   184, SPR_ARROW_UP,                       STR_NETWORK_NUMBER_OF_SPECTATORS_TIP}, // NSSW_SPECTATORS_BTNU
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1019
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1020
{       WWT_TEXT,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,   280,   419,   191,   203, STR_NETWORK_LANGUAGE_SPOKEN,        STR_NULL},
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1021
{ WWT_DROPDOWNIN,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,   280,   410,   205,   216, STR_NETWORK_LANGUAGE_COMBO,         STR_NETWORK_LANGUAGE_TIP},             // NSSW_LANGUAGE_BTN
7959
e0476faea1e2 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 7931
diff changeset
  1022
e0476faea1e2 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 7931
diff changeset
  1023
/* Buttons Start / Load / Cancel */
9827
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1024
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   COLOUR_WHITE,         40,   140,   224,   235, STR_NETWORK_START_GAME,             STR_NETWORK_START_GAME_TIP},           // NSSW_START
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1025
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   COLOUR_WHITE,        150,   250,   224,   235, STR_NETWORK_LOAD_GAME,              STR_NETWORK_LOAD_GAME_TIP},            // NSSW_LOAD
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1026
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   COLOUR_WHITE,        260,   360,   224,   235, STR_012E_CANCEL,                    STR_NULL},                             // NSSW_CANCEL
7959
e0476faea1e2 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 7931
diff changeset
  1027
176
84990c4b9212 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents: 175
diff changeset
  1028
{   WIDGETS_END},
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
  1029
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
  1030
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
  1031
static const WindowDesc _network_start_server_window_desc = {
7341
02515d0d4ced (svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents: 7321
diff changeset
  1032
	WDP_CENTER, WDP_CENTER, 420, 244, 420, 244,
5893
7e431a4abebb (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents: 5669
diff changeset
  1033
	WC_NETWORK_WINDOW, WC_NONE,
2064
e6a2b42d0b15 (svn r2573) Codechange: Removed WDF_RESTORE_DPARAM, it's not needed with the new string system.
ludde
parents: 2055
diff changeset
  1034
	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
  1035
	_network_start_server_window_widgets,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
  1036
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
  1037
6247
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5916
diff changeset
  1038
static void ShowNetworkStartServerWindow()
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
  1039
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
  1040
	DeleteWindowById(WC_NETWORK_WINDOW, 0);
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 176
diff changeset
  1041
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1042
	new NetworkStartServerWindow(&_network_start_server_window_desc);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
  1043
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
  1044
5587
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5584
diff changeset
  1045
static PlayerID NetworkLobbyFindCompanyIndex(byte pos)
734
f4ad2f5805fd (svn r1186) -Fix: [Network] You can now join a company on a server where a company
truelight
parents: 722
diff changeset
  1046
{
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1047
	/* Scroll through all _network_player_info and get the 'pos' item that is not empty */
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1048
	for (PlayerID i = PLAYER_FIRST; i < MAX_PLAYERS; i++) {
734
f4ad2f5805fd (svn r1186) -Fix: [Network] You can now join a company on a server where a company
truelight
parents: 722
diff changeset
  1049
		if (_network_player_info[i].company_name[0] != '\0') {
2639
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2630
diff changeset
  1050
			if (pos-- == 0) return i;
734
f4ad2f5805fd (svn r1186) -Fix: [Network] You can now join a company on a server where a company
truelight
parents: 722
diff changeset
  1051
		}
f4ad2f5805fd (svn r1186) -Fix: [Network] You can now join a company on a server where a company
truelight
parents: 722
diff changeset
  1052
	}
f4ad2f5805fd (svn r1186) -Fix: [Network] You can now join a company on a server where a company
truelight
parents: 722
diff changeset
  1053
5587
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5584
diff changeset
  1054
	return PLAYER_FIRST;
734
f4ad2f5805fd (svn r1186) -Fix: [Network] You can now join a company on a server where a company
truelight
parents: 722
diff changeset
  1055
}
f4ad2f5805fd (svn r1186) -Fix: [Network] You can now join a company on a server where a company
truelight
parents: 722
diff changeset
  1056
7963
bf9d4e26ea5b (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 7961
diff changeset
  1057
/** Enum for NetworkLobbyWindow, referring to _network_lobby_window_widgets */
bf9d4e26ea5b (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 7961
diff changeset
  1058
enum NetworkLobbyWindowWidgets {
bf9d4e26ea5b (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 7961
diff changeset
  1059
	NLWW_CLOSE    =  0, ///< Close 'X' button
bf9d4e26ea5b (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 7961
diff changeset
  1060
	NLWW_MATRIX   =  5, ///< List of companies
bf9d4e26ea5b (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 7961
diff changeset
  1061
	NLWW_DETAILS  =  7, ///< Company details
bf9d4e26ea5b (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 7961
diff changeset
  1062
	NLWW_JOIN     =  8, ///< 'Join company' button
bf9d4e26ea5b (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 7961
diff changeset
  1063
	NLWW_NEW      =  9, ///< 'New company' button
bf9d4e26ea5b (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 7961
diff changeset
  1064
	NLWW_SPECTATE = 10, ///< 'Spectate game' button
bf9d4e26ea5b (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 7961
diff changeset
  1065
	NLWW_REFRESH  = 11, ///< 'Refresh server' button
bf9d4e26ea5b (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 7961
diff changeset
  1066
	NLWW_CANCEL   = 12, ///< 'Cancel' button
bf9d4e26ea5b (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 7961
diff changeset
  1067
};
bf9d4e26ea5b (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 7961
diff changeset
  1068
9177
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1069
struct NetworkLobbyWindow : public Window {
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1070
	PlayerID company;        ///< Select company
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1071
	NetworkGameList *server; ///< Selected server
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1072
9177
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1073
	NetworkLobbyWindow(const WindowDesc *desc, NetworkGameList *ngl) :
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1074
			Window(desc), company(INVALID_PLAYER), server(ngl)
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1075
	{
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1076
		this->vscroll.cap = 10;
9178
3235f895bf12 (svn r13041) -Fix: calling a virtual function on a not fully constructed object is bound to cause errors.
rubidium
parents: 9177
diff changeset
  1077
3235f895bf12 (svn r13041) -Fix: calling a virtual function on a not fully constructed object is bound to cause errors.
rubidium
parents: 9177
diff changeset
  1078
		this->FindWindowPlacementAndResize(desc);
9177
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1079
	}
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1080
9177
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1081
	virtual void OnPaint()
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1082
	{
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1083
		const NetworkGameInfo *gi = &this->server->info;
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1084
		int y = NET_PRC__OFFSET_TOP_WIDGET_COMPANY, pos;
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1085
9177
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1086
		/* Join button is disabled when no company is selected */
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1087
		this->SetWidgetDisabledState(NLWW_JOIN, this->company == INVALID_PLAYER);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1088
		/* Cannot start new company if there are too many */
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1089
		this->SetWidgetDisabledState(NLWW_NEW, gi->companies_on >= gi->companies_max);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1090
		/* Cannot spectate if there are too many spectators */
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1091
		this->SetWidgetDisabledState(NLWW_SPECTATE, gi->spectators_on >= gi->spectators_max);
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1092
9177
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1093
		/* Draw window widgets */
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1094
		SetDParamStr(0, gi->server_name);
9273
35e0224ea8f1 (svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents: 9269
diff changeset
  1095
		this->DrawWidgets();
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1096
9177
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1097
		/* Draw company list */
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1098
		pos = this->vscroll.pos;
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1099
		while (pos < gi->companies_on) {
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1100
			byte company = NetworkLobbyFindCompanyIndex(pos);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1101
			bool income = false;
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1102
			if (this->company == company) {
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1103
				GfxFillRect(11, y - 1, 154, y + 10, 10); // show highlighted item with a different colour
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1104
			}
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1105
9177
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1106
			DoDrawStringTruncated(_network_player_info[company].company_name, 13, y, TC_BLACK, 135 - 13);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1107
			if (_network_player_info[company].use_password != 0) DrawSprite(SPR_LOCK, PAL_NONE, 135, y);
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1108
9177
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1109
			/* If the company's income was positive puts a green dot else a red dot */
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1110
			if (_network_player_info[company].income >= 0) income = true;
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1111
			DrawSprite(SPR_BLOT, income ? PALETTE_TO_GREEN : PALETTE_TO_RED, 145, y);
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1112
9177
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1113
			pos++;
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1114
			y += NET_PRC__SIZE_OF_ROW;
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1115
			if (pos >= this->vscroll.cap) break;
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1116
		}
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1117
9177
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1118
		/* Draw info about selected company when it is selected in the left window */
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1119
		GfxFillRect(174, 39, 403, 75, 157);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1120
		DrawStringCentered(290, 50, STR_NETWORK_COMPANY_INFO, TC_FROMSTRING);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1121
		if (this->company != INVALID_PLAYER) {
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1122
			const uint x = 183;
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1123
			const uint trunc_width = this->widget[NLWW_DETAILS].right - x;
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1124
			y = 80;
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1125
9177
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1126
			SetDParam(0, gi->clients_on);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1127
			SetDParam(1, gi->clients_max);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1128
			SetDParam(2, gi->companies_on);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1129
			SetDParam(3, gi->companies_max);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1130
			DrawString(x, y, STR_NETWORK_CLIENTS, TC_GOLD);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1131
			y += 10;
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1132
9177
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1133
			SetDParamStr(0, _network_player_info[this->company].company_name);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1134
			DrawStringTruncated(x, y, STR_NETWORK_COMPANY_NAME, TC_GOLD, trunc_width);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1135
			y += 10;
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1136
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1137
			SetDParam(0, _network_player_info[this->company].inaugurated_year);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1138
			DrawString(x, y, STR_NETWORK_INAUGURATION_YEAR, TC_GOLD); // inauguration year
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1139
			y += 10;
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1140
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1141
			SetDParam(0, _network_player_info[this->company].company_value);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1142
			DrawString(x, y, STR_NETWORK_VALUE, TC_GOLD); // company value
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1143
			y += 10;
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1144
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1145
			SetDParam(0, _network_player_info[this->company].money);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1146
			DrawString(x, y, STR_NETWORK_CURRENT_BALANCE, TC_GOLD); // current balance
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1147
			y += 10;
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1148
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1149
			SetDParam(0, _network_player_info[this->company].income);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1150
			DrawString(x, y, STR_NETWORK_LAST_YEARS_INCOME, TC_GOLD); // last year's income
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1151
			y += 10;
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1152
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1153
			SetDParam(0, _network_player_info[this->company].performance);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1154
			DrawString(x, y, STR_NETWORK_PERFORMANCE, TC_GOLD); // performance
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1155
			y += 10;
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1156
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1157
			SetDParam(0, _network_player_info[this->company].num_vehicle[0]);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1158
			SetDParam(1, _network_player_info[this->company].num_vehicle[1]);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1159
			SetDParam(2, _network_player_info[this->company].num_vehicle[2]);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1160
			SetDParam(3, _network_player_info[this->company].num_vehicle[3]);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1161
			SetDParam(4, _network_player_info[this->company].num_vehicle[4]);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1162
			DrawString(x, y, STR_NETWORK_VEHICLES, TC_GOLD); // vehicles
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1163
			y += 10;
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1164
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1165
			SetDParam(0, _network_player_info[this->company].num_station[0]);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1166
			SetDParam(1, _network_player_info[this->company].num_station[1]);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1167
			SetDParam(2, _network_player_info[this->company].num_station[2]);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1168
			SetDParam(3, _network_player_info[this->company].num_station[3]);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1169
			SetDParam(4, _network_player_info[this->company].num_station[4]);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1170
			DrawString(x, y, STR_NETWORK_STATIONS, TC_GOLD); // stations
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1171
			y += 10;
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1172
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1173
			SetDParamStr(0, _network_player_info[this->company].players);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1174
			DrawStringTruncated(x, y, STR_NETWORK_PLAYERS, TC_GOLD, trunc_width); // players
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1175
		}
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1176
	}
9177
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1177
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1178
	virtual void OnClick(Point pt, int widget)
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1179
	{
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1180
		switch (widget) {
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1181
			case NLWW_CLOSE:    // Close 'X'
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1182
			case NLWW_CANCEL:   // Cancel button
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1183
				ShowNetworkGameWindow();
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1184
				break;
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1185
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1186
			case NLWW_MATRIX: { // Company list
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1187
				uint32 id_v = (pt.y - NET_PRC__OFFSET_TOP_WIDGET_COMPANY) / NET_PRC__SIZE_OF_ROW;
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1188
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1189
				if (id_v >= this->vscroll.cap) break;
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1190
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1191
				id_v += this->vscroll.pos;
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1192
				this->company = (id_v >= this->server->info.companies_on) ? INVALID_PLAYER : NetworkLobbyFindCompanyIndex(id_v);
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1193
				this->SetDirty();
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1194
			} break;
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1195
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1196
			case NLWW_JOIN:     // Join company
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1197
				/* Button can be clicked only when it is enabled */
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1198
				_network_playas = this->company;
9420
8a38703928e8 (svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents: 9416
diff changeset
  1199
				NetworkClientConnectGame(_settings_client.network.last_host, _settings_client.network.last_port);
9177
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1200
				break;
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1201
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1202
			case NLWW_NEW:      // New company
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1203
				_network_playas = PLAYER_NEW_COMPANY;
9420
8a38703928e8 (svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents: 9416
diff changeset
  1204
				NetworkClientConnectGame(_settings_client.network.last_host, _settings_client.network.last_port);
9177
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1205
				break;
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1206
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1207
			case NLWW_SPECTATE: // Spectate game
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1208
				_network_playas = PLAYER_SPECTATOR;
9420
8a38703928e8 (svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents: 9416
diff changeset
  1209
				NetworkClientConnectGame(_settings_client.network.last_host, _settings_client.network.last_port);
9177
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1210
				break;
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1211
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1212
			case NLWW_REFRESH:  // Refresh
9420
8a38703928e8 (svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents: 9416
diff changeset
  1213
				NetworkTCPQueryServer(_settings_client.network.last_host, _settings_client.network.last_port); // company info
8a38703928e8 (svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents: 9416
diff changeset
  1214
				NetworkUDPQueryServer(_settings_client.network.last_host, _settings_client.network.last_port); // general data
9177
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1215
				break;
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1216
		}
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1217
	}
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1218
};
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1219
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1220
static const Widget _network_lobby_window_widgets[] = {
9827
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1221
{   WWT_CLOSEBOX,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,     0,    10,     0,    13, STR_00C5,                    STR_018B_CLOSE_WINDOW },           // NLWW_CLOSE
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1222
{    WWT_CAPTION,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,    11,   419,     0,    13, STR_NETWORK_GAME_LOBBY,      STR_NULL},
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1223
{      WWT_PANEL,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,     0,   419,    14,   234, 0x0,                         STR_NULL},
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1224
{       WWT_TEXT,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,    10,   419,    22,    34, STR_NETWORK_PREPARE_TO_JOIN, STR_NULL},
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1225
7963
bf9d4e26ea5b (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 7961
diff changeset
  1226
/* company list */
9827
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1227
{      WWT_PANEL,   RESIZE_NONE,   COLOUR_WHITE,         10,   155,    38,    49, 0x0,                         STR_NULL},
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1228
{     WWT_MATRIX,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,    10,   155,    50,   190, (10 << 8) + 1,               STR_NETWORK_COMPANY_LIST_TIP},     // NLWW_MATRIX
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1229
{  WWT_SCROLLBAR,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,   156,   167,    38,   190, 0x0,                         STR_0190_SCROLL_BAR_SCROLLS_LIST},
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1230
7963
bf9d4e26ea5b (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 7961
diff changeset
  1231
/* company/player info */
9827
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1232
{      WWT_PANEL,   RESIZE_NONE,   COLOUR_LIGHT_BLUE,   173,   404,    38,   190, 0x0,                         STR_NULL},                         // NLWW_DETAILS
7963
bf9d4e26ea5b (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 7961
diff changeset
  1233
bf9d4e26ea5b (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 7961
diff changeset
  1234
/* buttons */
9827
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1235
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   COLOUR_WHITE,         10,   151,   200,   211, STR_NETWORK_JOIN_COMPANY,    STR_NETWORK_JOIN_COMPANY_TIP},     // NLWW_JOIN
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1236
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   COLOUR_WHITE,         10,   151,   215,   226, STR_NETWORK_NEW_COMPANY,     STR_NETWORK_NEW_COMPANY_TIP},      // NLWW_NEW
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1237
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   COLOUR_WHITE,        158,   268,   200,   211, STR_NETWORK_SPECTATE_GAME,   STR_NETWORK_SPECTATE_GAME_TIP},    // NLWW_SPECTATE
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1238
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   COLOUR_WHITE,        158,   268,   215,   226, STR_NETWORK_REFRESH,         STR_NETWORK_REFRESH_TIP},          // NLWW_REFRESH
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1239
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   COLOUR_WHITE,        278,   388,   200,   211, STR_012E_CANCEL,             STR_NULL},                         // NLWW_CANCEL
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1240
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1241
{   WIDGETS_END},
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1242
};
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1243
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1244
static const WindowDesc _network_lobby_window_desc = {
7341
02515d0d4ced (svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents: 7321
diff changeset
  1245
	WDP_CENTER, WDP_CENTER, 420, 235, 420, 235,
5893
7e431a4abebb (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents: 5669
diff changeset
  1246
	WC_NETWORK_WINDOW, WC_NONE,
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1247
	WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1248
	_network_lobby_window_widgets,
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1249
};
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1250
2888
79da960a5372 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
  1251
/* Show the networklobbywindow with the selected server
79da960a5372 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
  1252
 * @param ngl Selected game pointer which is passed to the new window */
2887
810e555d5249 (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
  1253
static void ShowNetworkLobbyWindow(NetworkGameList *ngl)
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1254
{
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1255
	DeleteWindowById(WC_NETWORK_WINDOW, 0);
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1256
9420
8a38703928e8 (svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents: 9416
diff changeset
  1257
	NetworkTCPQueryServer(_settings_client.network.last_host, _settings_client.network.last_port); // company info
8a38703928e8 (svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents: 9416
diff changeset
  1258
	NetworkUDPQueryServer(_settings_client.network.last_host, _settings_client.network.last_port); // general data
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1259
9177
47a00c43444e (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 9165
diff changeset
  1260
	new NetworkLobbyWindow(&_network_lobby_window_desc, ngl);
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1261
}
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1262
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1263
// The window below gives information about the connected clients
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1264
//  and also makes able to give money to them, kick them (if server)
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1265
//  and stuff like that.
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1266
3692
1d8f5041d437 (svn r4623) - Codechange: s/byte/PlayerID/
Darkvater
parents: 3470
diff changeset
  1267
extern void DrawPlayerIcon(PlayerID pid, int x, int y);
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1268
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1269
// Every action must be of this form
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1270
typedef void ClientList_Action_Proc(byte client_no);
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1271
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1272
// Max 10 actions per client
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1273
#define MAX_CLIENTLIST_ACTION 10
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1274
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1275
enum {
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1276
	CLNWND_OFFSET = 16,
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1277
	CLNWND_ROWSIZE = 10
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1278
};
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1279
867
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 853
diff changeset
  1280
static const Widget _client_list_widgets[] = {
9827
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1281
{   WWT_CLOSEBOX,   RESIZE_NONE,  COLOUR_GREY,     0,    10,     0,    13, STR_00C5,                 STR_018B_CLOSE_WINDOW},
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1282
{    WWT_CAPTION,   RESIZE_NONE,  COLOUR_GREY,    11,   237,     0,    13, STR_NETWORK_CLIENT_LIST,  STR_018C_WINDOW_TITLE_DRAG_THIS},
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1283
{  WWT_STICKYBOX,   RESIZE_NONE,  COLOUR_GREY,   238,   249,     0,    13, STR_NULL,                 STR_STICKY_BUTTON},
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1284
9827
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1285
{      WWT_PANEL,   RESIZE_NONE,  COLOUR_GREY,     0,   249,    14,    14 + CLNWND_ROWSIZE + 1, 0x0, STR_NULL},
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1286
{   WIDGETS_END},
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1287
};
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1288
867
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 853
diff changeset
  1289
static const Widget _client_list_popup_widgets[] = {
9827
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1290
{      WWT_PANEL,   RESIZE_NONE,  COLOUR_GREY,     0,   99,     0,     0,     0, STR_NULL},
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1291
{   WIDGETS_END},
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1292
};
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1293
9317
f14eb8815829 (svn r13185) -Codechange: remove everything related to the WindowProc callbacks.
rubidium
parents: 9301
diff changeset
  1294
static const WindowDesc _client_list_desc = {
7341
02515d0d4ced (svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents: 7321
diff changeset
  1295
	WDP_AUTO, WDP_AUTO, 250, 1, 250, 1,
5893
7e431a4abebb (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents: 5669
diff changeset
  1296
	WC_CLIENT_LIST, WC_NONE,
7029
7b84f0befa90 (svn r10293) -Add [FS#885]: a sticky button for the client list window (oxygene)
truelight
parents: 7002
diff changeset
  1297
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1298
	_client_list_widgets,
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1299
};
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1300
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1301
// Finds the Xth client-info that is active
4171
5c6e60c392c3 (svn r5609) CodeChange : Apply coding style
belugas
parents: 4077
diff changeset
  1302
static const NetworkClientInfo *NetworkFindClientInfo(byte client_no)
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1303
{
4171
5c6e60c392c3 (svn r5609) CodeChange : Apply coding style
belugas
parents: 4077
diff changeset
  1304
	const NetworkClientInfo *ci;
2630
7206058a7e82 (svn r3172) static, const
tron
parents: 2549
diff changeset
  1305
4883
c9c7d15c0b0b (svn r6820) -Codechange: Some more const correctness, coding style.
Darkvater
parents: 4880
diff changeset
  1306
	FOR_ALL_ACTIVE_CLIENT_INFOS(ci) {
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1307
		if (client_no == 0) return ci;
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1308
		client_no--;
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1309
	}
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1310
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1311
	return NULL;
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1312
}
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1313
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1314
// Here we start to define the options out of the menu
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1315
static void ClientList_Kick(byte client_no)
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1316
{
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1317
	if (client_no < MAX_PLAYERS)
4880
aac84a9dcd03 (svn r6816) -Codechange: Some coding style, variable localization, const correctness.
Darkvater
parents: 4878
diff changeset
  1318
		SEND_COMMAND(PACKET_SERVER_ERROR)(DEREF_CLIENT(client_no), NETWORK_ERROR_KICKED);
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1319
}
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1320
841
4874b9ce2765 (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 827
diff changeset
  1321
static void ClientList_Ban(byte client_no)
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1322
{
841
4874b9ce2765 (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 827
diff changeset
  1323
	uint32 ip = NetworkFindClientInfo(client_no)->client_ip;
4874b9ce2765 (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 827
diff changeset
  1324
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1325
	for (uint i = 0; i < lengthof(_network_ban_list); i++) {
2914
ccfa238c6645 (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
  1326
		if (_network_ban_list[i] == NULL) {
841
4874b9ce2765 (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 827
diff changeset
  1327
			_network_ban_list[i] = strdup(inet_ntoa(*(struct in_addr *)&ip));
4874b9ce2765 (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 827
diff changeset
  1328
			break;
4874b9ce2765 (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 827
diff changeset
  1329
		}
4874b9ce2765 (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 827
diff changeset
  1330
	}
4874b9ce2765 (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 827
diff changeset
  1331
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1332
	if (client_no < MAX_PLAYERS) {
4880
aac84a9dcd03 (svn r6816) -Codechange: Some coding style, variable localization, const correctness.
Darkvater
parents: 4878
diff changeset
  1333
		SEND_COMMAND(PACKET_SERVER_ERROR)(DEREF_CLIENT(client_no), NETWORK_ERROR_KICKED);
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1334
	}
841
4874b9ce2765 (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 827
diff changeset
  1335
}
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1336
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1337
static void ClientList_GiveMoney(byte client_no)
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1338
{
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1339
	if (NetworkFindClientInfo(client_no) != NULL) {
4878
4d4f76a898fd (svn r6814) -Codechange: For network games ci->client_playas was always p->index + 1. To
Darkvater
parents: 4861
diff changeset
  1340
		ShowNetworkGiveMoneyWindow(NetworkFindClientInfo(client_no)->client_playas);
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1341
	}
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1342
}
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1343
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1344
static void ClientList_SpeakToClient(byte client_no)
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1345
{
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1346
	if (NetworkFindClientInfo(client_no) != NULL) {
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1347
		ShowNetworkChatQueryWindow(DESTTYPE_CLIENT, NetworkFindClientInfo(client_no)->client_index);
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1348
	}
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1349
}
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1350
4906
935e6280c093 (svn r6876) -Codechange: Change the naming of _PLAYER in DESTTYPE_PLAYER/NETWORK_ACTION_CHAT_PLAYER
Darkvater
parents: 4895
diff changeset
  1351
static void ClientList_SpeakToCompany(byte client_no)
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1352
{
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1353
	if (NetworkFindClientInfo(client_no) != NULL) {
4906
935e6280c093 (svn r6876) -Codechange: Change the naming of _PLAYER in DESTTYPE_PLAYER/NETWORK_ACTION_CHAT_PLAYER
Darkvater
parents: 4895
diff changeset
  1354
		ShowNetworkChatQueryWindow(DESTTYPE_TEAM, NetworkFindClientInfo(client_no)->client_playas);
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1355
	}
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1356
}
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1357
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1358
static void ClientList_SpeakToAll(byte client_no)
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1359
{
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1360
	ShowNetworkChatQueryWindow(DESTTYPE_BROADCAST, 0);
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1361
}
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1362
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1363
static void ClientList_None(byte client_no)
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1364
{
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1365
	/* No action ;) */
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1366
}
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1367
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1368
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1369
9242
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1370
struct NetworkClientListPopupWindow : Window {
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1371
	int sel_index;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1372
	int client_no;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1373
	char action[MAX_CLIENTLIST_ACTION][50];
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1374
	ClientList_Action_Proc *proc[MAX_CLIENTLIST_ACTION];
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1375
9242
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1376
	NetworkClientListPopupWindow(int x, int y, const Widget *widgets, int client_no) :
9301
3b20dfb6c4e8 (svn r13169) -Codechange: remove a (now) unneeded parameter of one of the Window constructors.
rubidium
parents: 9285
diff changeset
  1377
			Window(x, y, 150, 100, WC_TOOLBAR_MENU, widgets),
9242
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1378
			sel_index(0), client_no(client_no)
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1379
	{
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1380
		/*
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1381
		 * Fill the actions this client has.
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1382
		 * Watch is, max 50 chars long!
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1383
		 */
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1384
9242
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1385
		const NetworkClientInfo *ci = NetworkFindClientInfo(client_no);
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1386
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1387
		int i = 0;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1388
		if (_network_own_client_index != ci->client_index) {
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1389
			GetString(this->action[i], STR_NETWORK_CLIENTLIST_SPEAK_TO_CLIENT, lastof(this->action[i]));
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1390
			this->proc[i++] = &ClientList_SpeakToClient;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1391
		}
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1392
9652
0405e98d8e96 (svn r13719) -Codechange: rename IsValidPlayer to IsValidPlayerID in line with all other structs/classes that are in a pool.
rubidium
parents: 9648
diff changeset
  1393
		if (IsValidPlayerID(ci->client_playas) || ci->client_playas == PLAYER_SPECTATOR) {
9242
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1394
			GetString(this->action[i], STR_NETWORK_CLIENTLIST_SPEAK_TO_COMPANY, lastof(this->action[i]));
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1395
			this->proc[i++] = &ClientList_SpeakToCompany;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1396
		}
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1397
		GetString(this->action[i], STR_NETWORK_CLIENTLIST_SPEAK_TO_ALL, lastof(this->action[i]));
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1398
		this->proc[i++] = &ClientList_SpeakToAll;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1399
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1400
		if (_network_own_client_index != ci->client_index) {
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1401
			/* We are no spectator and the player we want to give money to is no spectator and money gifts are allowed */
9652
0405e98d8e96 (svn r13719) -Codechange: rename IsValidPlayer to IsValidPlayerID in line with all other structs/classes that are in a pool.
rubidium
parents: 9648
diff changeset
  1402
			if (IsValidPlayerID(_network_playas) && IsValidPlayerID(ci->client_playas) && _settings_game.economy.give_money) {
9242
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1403
				GetString(this->action[i], STR_NETWORK_CLIENTLIST_GIVE_MONEY, lastof(this->action[i]));
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1404
				this->proc[i++] = &ClientList_GiveMoney;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1405
			}
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1406
		}
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1407
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1408
		/* A server can kick clients (but not himself) */
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1409
		if (_network_server && _network_own_client_index != ci->client_index) {
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1410
			GetString(this->action[i], STR_NETWORK_CLIENTLIST_KICK, lastof(this->action[i]));
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1411
			this->proc[i++] = &ClientList_Kick;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1412
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1413
			sprintf(this->action[i],"Ban"); // XXX GetString?
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1414
			this->proc[i++] = &ClientList_Ban;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1415
		}
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1416
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1417
		if (i == 0) {
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1418
			GetString(this->action[i], STR_NETWORK_CLIENTLIST_NONE, lastof(this->action[i]));
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1419
			this->proc[i++] = &ClientList_None;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1420
		}
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1421
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1422
		/* Calculate the height */
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1423
		int h = ClientListPopupHeight();
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1424
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1425
		/* Allocate the popup */
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1426
		this->widget[0].bottom = this->widget[0].top + h;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1427
		this->widget[0].right = this->widget[0].left + 150;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1428
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1429
		this->flags4 &= ~WF_WHITE_BORDER_MASK;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1430
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1431
		this->FindWindowPlacementAndResize(150, h + 1);
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1432
	}
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1433
9242
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1434
	/**
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1435
	 * An action is clicked! What do we do?
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1436
	 */
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1437
	void HandleClientListPopupClick(byte index)
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1438
	{
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1439
		/* A click on the Popup of the ClientList.. handle the command */
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1440
		if (index < MAX_CLIENTLIST_ACTION && this->proc[index] != NULL) {
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1441
			this->proc[index](this->client_no);
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1442
		}
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1443
	}
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1444
9242
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1445
	/**
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1446
	 * Finds the amount of actions in the popup and set the height correct
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1447
	 */
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1448
	uint ClientListPopupHeight()
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1449
	{
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1450
		int num = 0;
867
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 853
diff changeset
  1451
9242
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1452
		// Find the amount of actions
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1453
		for (int i = 0; i < MAX_CLIENTLIST_ACTION; i++) {
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1454
			if (this->action[i][0] == '\0') continue;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1455
			if (this->proc[i] == NULL) continue;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1456
			num++;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1457
		}
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1458
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1459
		num *= CLNWND_ROWSIZE;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1460
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1461
		return num + 1;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1462
	}
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1463
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1464
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1465
	virtual void OnPaint()
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1466
	{
9273
35e0224ea8f1 (svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents: 9269
diff changeset
  1467
		this->DrawWidgets();
9242
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1468
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1469
		/* Draw the actions */
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1470
		int sel = this->sel_index;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1471
		int y = 1;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1472
		for (int i = 0; i < MAX_CLIENTLIST_ACTION; i++, y += CLNWND_ROWSIZE) {
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1473
			if (this->action[i][0] == '\0') continue;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1474
			if (this->proc[i] == NULL) continue;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1475
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1476
			TextColour colour;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1477
			if (sel-- == 0) { // Selected item, highlight it
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1478
				GfxFillRect(1, y, 150 - 2, y + CLNWND_ROWSIZE - 1, 0);
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1479
				colour = TC_WHITE;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1480
			} else {
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1481
				colour = TC_BLACK;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1482
			}
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1483
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1484
			DoDrawString(this->action[i], 4, y, colour);
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1485
		}
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1486
	}
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1487
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1488
	virtual void OnMouseLoop()
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1489
	{
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1490
		/* We selected an action */
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1491
		int index = (_cursor.pos.y - this->top) / CLNWND_ROWSIZE;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1492
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1493
		if (_left_button_down) {
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1494
			if (index == -1 || index == this->sel_index) return;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1495
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1496
			this->sel_index = index;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1497
			this->SetDirty();
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1498
		} else {
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1499
			if (index >= 0 && _cursor.pos.y >= this->top) {
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1500
				HandleClientListPopupClick(index);
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1501
			}
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1502
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1503
			DeleteWindowById(WC_TOOLBAR_MENU, 0);
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1504
		}
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1505
	}
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1506
};
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1507
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1508
/**
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1509
 * Show the popup (action list)
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1510
 */
9242
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1511
static void PopupClientList(int client_no, int x, int y)
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1512
{
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1513
	DeleteWindowById(WC_TOOLBAR_MENU, 0);
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1514
9242
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1515
	if (NetworkFindClientInfo(client_no) == NULL) return;
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1516
9242
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1517
	new NetworkClientListPopupWindow(x, y, _client_list_popup_widgets, client_no);
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1518
}
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1519
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1520
/**
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1521
 * Main handle for clientlist
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1522
 */
9242
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1523
struct NetworkClientListWindow : Window
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1524
{
9242
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1525
	byte selected_item;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1526
	byte selected_y;
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1527
9242
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1528
	NetworkClientListWindow(const WindowDesc *desc, WindowNumber window_number) :
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1529
			Window(desc, window_number),
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1530
			selected_item(0),
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1531
			selected_y(255)
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1532
	{
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1533
		this->FindWindowPlacementAndResize(desc);
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1534
	}
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1535
9242
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1536
	/**
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1537
	 * Finds the amount of clients and set the height correct
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1538
	 */
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1539
	bool CheckClientListHeight()
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1540
	{
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1541
		int num = 0;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1542
		const NetworkClientInfo *ci;
8738
05aca6d9471b (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 8737
diff changeset
  1543
9242
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1544
		/* Should be replaced with a loop through all clients */
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1545
		FOR_ALL_ACTIVE_CLIENT_INFOS(ci) {
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1546
			num++;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1547
		}
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1548
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1549
		num *= CLNWND_ROWSIZE;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1550
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1551
		/* If height is changed */
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1552
		if (this->height != CLNWND_OFFSET + num + 1) {
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1553
			// XXX - magic unfortunately; (num + 2) has to be one bigger than heigh (num + 1)
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1554
			this->SetDirty();
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1555
			this->widget[3].bottom = this->widget[3].top + num + 2;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1556
			this->height = CLNWND_OFFSET + num + 1;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1557
			this->SetDirty();
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1558
			return false;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1559
		}
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1560
		return true;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1561
	}
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1562
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1563
	virtual void OnPaint()
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1564
	{
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1565
		NetworkClientInfo *ci;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1566
		int i = 0;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1567
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1568
		/* Check if we need to reset the height */
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1569
		if (!this->CheckClientListHeight()) return;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1570
9273
35e0224ea8f1 (svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents: 9269
diff changeset
  1571
		this->DrawWidgets();
9242
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1572
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1573
		int y = CLNWND_OFFSET;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1574
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1575
		FOR_ALL_ACTIVE_CLIENT_INFOS(ci) {
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1576
			TextColour colour;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1577
			if (this->selected_item == i++) { // Selected item, highlight it
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1578
				GfxFillRect(1, y, 248, y + CLNWND_ROWSIZE - 1, 0);
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1579
				colour = TC_WHITE;
4077
d4d440dd8925 (svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents: 4013
diff changeset
  1580
			} else {
9242
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1581
				colour = TC_BLACK;
2639
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2630
diff changeset
  1582
			}
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1583
9242
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1584
			if (ci->client_index == NETWORK_SERVER_INDEX) {
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1585
				DrawString(4, y, STR_NETWORK_SERVER, colour);
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1586
			} else {
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1587
				DrawString(4, y, STR_NETWORK_CLIENT, colour);
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1588
			}
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1589
9242
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1590
			/* Filter out spectators */
9652
0405e98d8e96 (svn r13719) -Codechange: rename IsValidPlayer to IsValidPlayerID in line with all other structs/classes that are in a pool.
rubidium
parents: 9648
diff changeset
  1591
			if (IsValidPlayerID(ci->client_playas)) DrawPlayerIcon(ci->client_playas, 64, y + 1);
9242
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1592
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1593
			DoDrawString(ci->client_name, 81, y, colour);
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1594
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1595
			y += CLNWND_ROWSIZE;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1596
		}
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1597
	}
9242
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1598
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1599
	virtual void OnClick(Point pt, int widget)
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1600
	{
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1601
		/* Show the popup with option */
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1602
		if (this->selected_item != 255) {
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1603
			PopupClientList(this->selected_item, pt.x + this->left, pt.y + this->top);
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1604
		}
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1605
	}
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1606
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1607
	virtual void OnMouseOver(Point pt, int widget)
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1608
	{
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1609
		/* -1 means we left the current window */
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1610
		if (pt.y == -1) {
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1611
			this->selected_y = 0;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1612
			this->selected_item = 255;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1613
			this->SetDirty();
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1614
			return;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1615
		}
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1616
		/* It did not change.. no update! */
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1617
		if (pt.y == this->selected_y) return;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1618
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1619
		/* Find the new selected item (if any) */
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1620
		this->selected_y = pt.y;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1621
		if (pt.y > CLNWND_OFFSET) {
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1622
			this->selected_item = (pt.y - CLNWND_OFFSET) / CLNWND_ROWSIZE;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1623
		} else {
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1624
			this->selected_item = 255;
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1625
		}
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1626
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1627
		/* Repaint */
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1628
		this->SetDirty();
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1629
	}
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1630
};
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1631
6247
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5916
diff changeset
  1632
void ShowClientList()
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1633
{
9242
787ddde2b852 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 9241
diff changeset
  1634
	AllocateWindowDescFront<NetworkClientListWindow>(&_client_list_desc, 0);
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1635
}
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1636
4512
823dfd4aa413 (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
  1637
823dfd4aa413 (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
  1638
static NetworkPasswordType pw_type;
823dfd4aa413 (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
  1639
823dfd4aa413 (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
  1640
823dfd4aa413 (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
  1641
void ShowNetworkNeedPassword(NetworkPasswordType npt)
823dfd4aa413 (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
  1642
{
823dfd4aa413 (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
  1643
	StringID caption;
823dfd4aa413 (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
  1644
823dfd4aa413 (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
  1645
	pw_type = npt;
823dfd4aa413 (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
  1646
	switch (npt) {
823dfd4aa413 (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
  1647
		default: NOT_REACHED();
4774
f93b1f0a9cf3 (svn r6688) -Fix (r6297): Wrong caption for server password query window (eg put 'break' after switch statements)
Darkvater
parents: 4719
diff changeset
  1648
		case NETWORK_GAME_PASSWORD:    caption = STR_NETWORK_NEED_GAME_PASSWORD_CAPTION; break;
f93b1f0a9cf3 (svn r6688) -Fix (r6297): Wrong caption for server password query window (eg put 'break' after switch statements)
Darkvater
parents: 4719
diff changeset
  1649
		case NETWORK_COMPANY_PASSWORD: caption = STR_NETWORK_NEED_COMPANY_PASSWORD_CAPTION; break;
4512
823dfd4aa413 (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
  1650
	}
5431
6e56b4f13dd7 (svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents: 5352
diff changeset
  1651
	ShowQueryString(STR_EMPTY, caption, 20, 180, FindWindowById(WC_NETWORK_STATUS_WINDOW, 0), CS_ALPHANUMERAL);
4512
823dfd4aa413 (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
  1652
}
823dfd4aa413 (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
  1653
9428
1ba05b499957 (svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium
parents: 9420
diff changeset
  1654
// Vars needed for the join-GUI
1ba05b499957 (svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium
parents: 9420
diff changeset
  1655
NetworkJoinStatus _network_join_status;
1ba05b499957 (svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium
parents: 9420
diff changeset
  1656
uint8 _network_join_waiting;
1ba05b499957 (svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium
parents: 9420
diff changeset
  1657
uint16 _network_join_kbytes;
1ba05b499957 (svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium
parents: 9420
diff changeset
  1658
uint16 _network_join_kbytes_total;
1ba05b499957 (svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium
parents: 9420
diff changeset
  1659
9269
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1660
struct NetworkJoinStatusWindow : Window {
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1661
	NetworkJoinStatusWindow(const WindowDesc *desc) : Window(desc)
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1662
	{
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1663
		this->parent = FindWindowById(WC_NETWORK_WINDOW, 0);
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1664
	}
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1665
9269
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1666
	virtual void OnPaint()
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1667
	{
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1668
		uint8 progress; // used for progress bar
9273
35e0224ea8f1 (svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents: 9269
diff changeset
  1669
		this->DrawWidgets();
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1670
9269
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1671
		DrawStringCentered(125, 35, STR_NETWORK_CONNECTING_1 + _network_join_status, TC_GREY);
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1672
		switch (_network_join_status) {
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1673
			case NETWORK_JOIN_STATUS_CONNECTING: case NETWORK_JOIN_STATUS_AUTHORIZING:
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1674
			case NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO:
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1675
				progress = 10; // first two stages 10%
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1676
				break;
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1677
			case NETWORK_JOIN_STATUS_WAITING:
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1678
				SetDParam(0, _network_join_waiting);
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1679
				DrawStringCentered(125, 46, STR_NETWORK_CONNECTING_WAITING, TC_GREY);
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1680
				progress = 15; // third stage is 15%
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1681
				break;
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1682
			case NETWORK_JOIN_STATUS_DOWNLOADING:
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1683
				SetDParam(0, _network_join_kbytes);
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1684
				SetDParam(1, _network_join_kbytes_total);
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1685
				DrawStringCentered(125, 46, STR_NETWORK_CONNECTING_DOWNLOADING, TC_GREY);
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1686
				/* Fallthrough */
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1687
			default: /* Waiting is 15%, so the resting receivement of map is maximum 70% */
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1688
				progress = 15 + _network_join_kbytes * (100 - 15) / _network_join_kbytes_total;
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1689
		}
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1690
9269
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1691
		/* Draw nice progress bar :) */
9770
8c260fb382f8 (svn r13907) -Codechange: Replace a number with Colours enum on DrawFrameRect usage
belugas
parents: 9690
diff changeset
  1692
		DrawFrameRect(20, 18, (int)((this->width - 20) * progress / 100), 28, COLOUR_MAUVE, FR_NONE);
9269
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1693
	}
4512
823dfd4aa413 (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
  1694
9269
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1695
	virtual void OnClick(Point pt, int widget)
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1696
	{
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1697
		if (widget == 2) { //Disconnect button
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1698
			NetworkDisconnect();
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1699
			SwitchMode(SM_MENU);
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1700
			ShowNetworkGameWindow();
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1701
		}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
  1702
	}
9269
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1703
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1704
	virtual void OnQueryTextFinished(char *str)
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1705
	{
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1706
		if (StrEmpty(str)) {
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1707
			NetworkDisconnect();
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1708
			ShowNetworkGameWindow();
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1709
		} else {
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1710
			SEND_COMMAND(PACKET_CLIENT_PASSWORD)(pw_type, str);
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1711
		}
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1712
	}
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1713
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
  1714
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1715
static const Widget _network_join_status_window_widget[] = {
9827
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1716
{    WWT_CAPTION,   RESIZE_NONE,  COLOUR_GREY,      0,   249,     0,    13, STR_NETWORK_CONNECTING, STR_018C_WINDOW_TITLE_DRAG_THIS},
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1717
{      WWT_PANEL,   RESIZE_NONE,  COLOUR_GREY,      0,   249,    14,    84, 0x0,                    STR_NULL},
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1718
{ WWT_PUSHTXTBTN,   RESIZE_NONE,  COLOUR_WHITE,    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
  1719
{   WIDGETS_END},
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
  1720
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
  1721
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1722
static const WindowDesc _network_join_status_window_desc = {
7341
02515d0d4ced (svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents: 7321
diff changeset
  1723
	WDP_CENTER, WDP_CENTER, 250, 85, 250, 85,
5893
7e431a4abebb (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents: 5669
diff changeset
  1724
	WC_NETWORK_STATUS_WINDOW, WC_NONE,
5432
5940d6a253c5 (svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents: 5431
diff changeset
  1725
	WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_MODAL,
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1726
	_network_join_status_window_widget,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
  1727
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
  1728
6247
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5916
diff changeset
  1729
void ShowJoinStatusWindow()
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1730
{
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1731
	DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
9269
599675909c2f (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 9242
diff changeset
  1732
	new NetworkJoinStatusWindow(&_network_join_status_window_desc);
670
d164965bb35a (svn r1108) -Fix: [Network] Fixed problem around slow clients:
truelight
parents: 659
diff changeset
  1733
}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
  1734
6531
4445b25832c4 (svn r9719) -Fix: in-game private messages did not work for clients with a Client ID > 255.
rubidium
parents: 6492
diff changeset
  1735
static void SendChat(const char *buf, DestType type, int dest)
4013
53a7dd9a1fbf (svn r5226) Reduce the mess that sending chat messages is
tron
parents: 3860
diff changeset
  1736
{
7321
f91bdca345e8 (svn r10684) -Codechange: some more coding style related changes. Primarily moving { to a new line.
rubidium
parents: 7221
diff changeset
  1737
	if (StrEmpty(buf)) return;
4013
53a7dd9a1fbf (svn r5226) Reduce the mess that sending chat messages is
tron
parents: 3860
diff changeset
  1738
	if (!_network_server) {
5587
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5584
diff changeset
  1739
		SEND_COMMAND(PACKET_CLIENT_CHAT)((NetworkAction)(NETWORK_ACTION_CHAT + type), type, dest, buf);
4013
53a7dd9a1fbf (svn r5226) Reduce the mess that sending chat messages is
tron
parents: 3860
diff changeset
  1740
	} else {
9428
1ba05b499957 (svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium
parents: 9420
diff changeset
  1741
		NetworkServerSendChat((NetworkAction)(NETWORK_ACTION_CHAT + type), type, dest, buf, NETWORK_SERVER_INDEX);
4013
53a7dd9a1fbf (svn r5226) Reduce the mess that sending chat messages is
tron
parents: 3860
diff changeset
  1742
	}
53a7dd9a1fbf (svn r5226) Reduce the mess that sending chat messages is
tron
parents: 3860
diff changeset
  1743
}
53a7dd9a1fbf (svn r5226) Reduce the mess that sending chat messages is
tron
parents: 3860
diff changeset
  1744
4315
2e634e3ecd02 (svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents: 4300
diff changeset
  1745
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1746
struct NetworkChatWindow : public QueryStringBaseWindow {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1747
	DestType dtype;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1748
	int dest;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1749
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1750
	NetworkChatWindow (const WindowDesc *desc, DestType type, int dest) : QueryStringBaseWindow(desc)
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1751
	{
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1752
		this->LowerWidget(2);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1753
		this->dtype   = type;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1754
		this->dest    = dest;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1755
		this->afilter = CS_ALPHANUMERAL;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1756
		InitializeTextBuffer(&this->text, this->edit_str_buf, lengthof(this->edit_str_buf), 0);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1757
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1758
		InvalidateWindowData(WC_NEWS_WINDOW, 0, this->height);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1759
		SetBit(_no_scroll, SCROLL_CHAT); // do not scroll the game with the arrow-keys
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1760
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1761
		_chat_tab_completion_active = false;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1762
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1763
		this->FindWindowPlacementAndResize(desc);
4315
2e634e3ecd02 (svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents: 4300
diff changeset
  1764
	}
2e634e3ecd02 (svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents: 4300
diff changeset
  1765
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1766
	~NetworkChatWindow ()
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1767
	{
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1768
		InvalidateWindowData(WC_NEWS_WINDOW, 0, 0);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1769
		ClrBit(_no_scroll, SCROLL_CHAT);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1770
	}
4315
2e634e3ecd02 (svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents: 4300
diff changeset
  1771
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1772
	/**
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1773
	 * Find the next item of the list of things that can be auto-completed.
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1774
	 * @param item The current indexed item to return. This function can, and most
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1775
	 *     likely will, alter item, to skip empty items in the arrays.
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1776
	 * @return Returns the char that matched to the index.
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1777
	 */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1778
	const char *ChatTabCompletionNextItem(uint *item)
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1779
	{
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1780
		static char chat_tab_temp_buffer[64];
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1781
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1782
		/* First, try clients */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1783
		if (*item < MAX_CLIENT_INFO) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1784
			/* Skip inactive clients */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1785
			while (_network_client_info[*item].client_index == NETWORK_EMPTY_INDEX && *item < MAX_CLIENT_INFO) (*item)++;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1786
			if (*item < MAX_CLIENT_INFO) return _network_client_info[*item].client_name;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1787
		}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1788
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1789
		/* Then, try townnames */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1790
		/* Not that the following assumes all town indices are adjacent, ie no
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1791
		* towns have been deleted. */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1792
		if (*item <= (uint)MAX_CLIENT_INFO + GetMaxTownIndex()) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1793
			const Town *t;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1794
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1795
			FOR_ALL_TOWNS_FROM(t, *item - MAX_CLIENT_INFO) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1796
				/* Get the town-name via the string-system */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1797
				SetDParam(0, t->index);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1798
				GetString(chat_tab_temp_buffer, STR_TOWN, lastof(chat_tab_temp_buffer));
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1799
				return &chat_tab_temp_buffer[0];
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1800
			}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1801
		}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1802
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1803
		return NULL;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1804
	}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1805
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1806
	/**
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1807
	 * Find what text to complete. It scans for a space from the left and marks
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1808
	 *  the word right from that as to complete. It also writes a \0 at the
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1809
	 *  position of the space (if any). If nothing found, buf is returned.
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1810
	 */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1811
	static char *ChatTabCompletionFindText(char *buf)
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1812
	{
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1813
		char *p = strrchr(buf, ' ');
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1814
		if (p == NULL) return buf;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1815
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1816
		*p = '\0';
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1817
		return p + 1;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1818
	}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1819
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1820
	/**
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1821
	 * See if we can auto-complete the current text of the user.
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1822
	 */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1823
	void ChatTabCompletion()
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1824
	{
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1825
		static char _chat_tab_completion_buf[lengthof(this->edit_str_buf)];
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1826
		Textbuf *tb = &this->text;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1827
		size_t len, tb_len;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1828
		uint item;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1829
		char *tb_buf, *pre_buf;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1830
		const char *cur_name;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1831
		bool second_scan = false;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1832
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1833
		item = 0;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1834
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1835
		/* Copy the buffer so we can modify it without damaging the real data */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1836
		pre_buf = (_chat_tab_completion_active) ? strdup(_chat_tab_completion_buf) : strdup(tb->buf);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1837
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1838
		tb_buf  = ChatTabCompletionFindText(pre_buf);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1839
		tb_len  = strlen(tb_buf);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1840
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1841
		while ((cur_name = ChatTabCompletionNextItem(&item)) != NULL) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1842
			item++;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1843
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1844
			if (_chat_tab_completion_active) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1845
				/* We are pressing TAB again on the same name, is there an other name
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1846
				*  that starts with this? */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1847
				if (!second_scan) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1848
					size_t offset;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1849
					size_t length;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1850
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1851
					/* If we are completing at the begin of the line, skip the ': ' we added */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1852
					if (tb_buf == pre_buf) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1853
						offset = 0;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1854
						length = tb->length - 2;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1855
					} else {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1856
						/* Else, find the place we are completing at */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1857
						offset = strlen(pre_buf) + 1;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1858
						length = tb->length - offset;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1859
					}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1860
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1861
					/* Compare if we have a match */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1862
					if (strlen(cur_name) == length && strncmp(cur_name, tb->buf + offset, length) == 0) second_scan = true;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1863
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1864
					continue;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1865
				}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1866
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1867
				/* Now any match we make on _chat_tab_completion_buf after this, is perfect */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1868
			}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1869
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1870
			len = strlen(cur_name);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1871
			if (tb_len < len && strncasecmp(cur_name, tb_buf, tb_len) == 0) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1872
				/* Save the data it was before completion */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1873
				if (!second_scan) snprintf(_chat_tab_completion_buf, lengthof(_chat_tab_completion_buf), "%s", tb->buf);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1874
				_chat_tab_completion_active = true;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1875
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1876
				/* Change to the found name. Add ': ' if we are at the start of the line (pretty) */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1877
				if (pre_buf == tb_buf) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1878
					snprintf(tb->buf, lengthof(this->edit_str_buf), "%s: ", cur_name);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1879
				} else {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1880
					snprintf(tb->buf, lengthof(this->edit_str_buf), "%s %s", pre_buf, cur_name);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1881
				}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1882
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1883
				/* Update the textbuffer */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1884
				UpdateTextBufferSize(&this->text);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1885
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1886
				this->SetDirty();
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1887
				free(pre_buf);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1888
				return;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1889
			}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1890
		}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1891
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1892
		if (second_scan) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1893
			/* We walked all posibilities, and the user presses tab again.. revert to original text */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1894
			strcpy(tb->buf, _chat_tab_completion_buf);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1895
			_chat_tab_completion_active = false;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1896
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1897
			/* Update the textbuffer */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1898
			UpdateTextBufferSize(&this->text);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1899
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1900
			this->SetDirty();
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1901
		}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1902
		free(pre_buf);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1903
	}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1904
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1905
	virtual void OnPaint()
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1906
	{
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1907
		static const StringID chat_captions[] = {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1908
			STR_NETWORK_CHAT_ALL_CAPTION,
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1909
			STR_NETWORK_CHAT_COMPANY_CAPTION,
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1910
			STR_NETWORK_CHAT_CLIENT_CAPTION
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1911
		};
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1912
9273
35e0224ea8f1 (svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents: 9269
diff changeset
  1913
		this->DrawWidgets();
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1914
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1915
		assert((uint)this->dtype < lengthof(chat_captions));
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1916
		DrawStringRightAligned(this->widget[2].left - 2, this->widget[2].top + 1, chat_captions[this->dtype], TC_BLACK);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1917
		this->DrawEditBox(2);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1918
	}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1919
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1920
	virtual void OnClick(Point pt, int widget)
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1921
	{
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1922
		switch (widget) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1923
			case 2:
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1924
				ShowOnScreenKeyboard(this, 2, 0, 3);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1925
				break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1926
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1927
			case 3: /* Send */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1928
				SendChat(this->text.buf, this->dtype, this->dest);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1929
			/* FALLTHROUGH */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1930
			case 0: /* Cancel */ delete this; break;
4315
2e634e3ecd02 (svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents: 4300
diff changeset
  1931
		}
2e634e3ecd02 (svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents: 4300
diff changeset
  1932
	}
2e634e3ecd02 (svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents: 4300
diff changeset
  1933
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1934
	virtual void OnMouseLoop()
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1935
	{
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1936
		this->HandleEditBox(2);
4315
2e634e3ecd02 (svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents: 4300
diff changeset
  1937
	}
2e634e3ecd02 (svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents: 4300
diff changeset
  1938
9285
235e5e2d7f55 (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: 9274
diff changeset
  1939
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1940
	{
9285
235e5e2d7f55 (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: 9274
diff changeset
  1941
		EventState state = ES_NOT_HANDLED;
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1942
		if (keycode == WKC_TAB) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1943
			ChatTabCompletion();
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1944
		} else {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1945
			_chat_tab_completion_active = false;
9285
235e5e2d7f55 (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: 9274
diff changeset
  1946
			switch (this->HandleEditBoxKey(2, key, keycode, state)) {
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1947
				case 1: /* Return */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1948
					SendChat(this->text.buf, this->dtype, this->dest);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1949
				/* FALLTHROUGH */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1950
				case 2: /* Escape */ delete this; break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1951
			}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1952
		}
9285
235e5e2d7f55 (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: 9274
diff changeset
  1953
		return state;
4315
2e634e3ecd02 (svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents: 4300
diff changeset
  1954
	}
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1955
};
649
bc9bdefb76ec (svn r1082) Feature: Chat toolbar
dominik
parents: 624
diff changeset
  1956
bc9bdefb76ec (svn r1082) Feature: Chat toolbar
dominik
parents: 624
diff changeset
  1957
static const Widget _chat_window_widgets[] = {
9827
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1958
{   WWT_CLOSEBOX, RESIZE_NONE,   COLOUR_GREY,   0,  10,  0, 13, STR_00C5,                  STR_018B_CLOSE_WINDOW},
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1959
{      WWT_PANEL, RESIZE_RIGHT,  COLOUR_GREY,  11, 319,  0, 13, 0x0,                       STR_NULL}, // background
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1960
{    WWT_EDITBOX, RESIZE_RIGHT,  COLOUR_GREY,  75, 257,  1, 12, STR_NETWORK_CHAT_OSKTITLE, STR_NULL}, // text box
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  1961
{ WWT_PUSHTXTBTN, RESIZE_LR,     COLOUR_GREY, 258, 319,  1, 12, STR_NETWORK_SEND,          STR_NULL}, // send button
649
bc9bdefb76ec (svn r1082) Feature: Chat toolbar
dominik
parents: 624
diff changeset
  1962
{   WIDGETS_END},
bc9bdefb76ec (svn r1082) Feature: Chat toolbar
dominik
parents: 624
diff changeset
  1963
};
bc9bdefb76ec (svn r1082) Feature: Chat toolbar
dominik
parents: 624
diff changeset
  1964
bc9bdefb76ec (svn r1082) Feature: Chat toolbar
dominik
parents: 624
diff changeset
  1965
static const WindowDesc _chat_window_desc = {
7363
2600aa1a6b16 (svn r10726) -Codechange: make it possible that the chat window is less than 640 pixels.
rubidium
parents: 7343
diff changeset
  1966
	WDP_CENTER, -26, 320, 14, 640, 14, // x, y, width, height
5893
7e431a4abebb (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents: 5669
diff changeset
  1967
	WC_SEND_NETWORK_MSG, WC_NONE,
8019
fc0e94dee165 (svn r11579) -Revert(r11578): some cases of key propagation are not handled correctly.
belugas
parents: 8018
diff changeset
  1968
	WDF_STD_TOOLTIPS | WDF_DEF_WIDGET,
649
bc9bdefb76ec (svn r1082) Feature: Chat toolbar
dominik
parents: 624
diff changeset
  1969
	_chat_window_widgets,
bc9bdefb76ec (svn r1082) Feature: Chat toolbar
dominik
parents: 624
diff changeset
  1970
};
bc9bdefb76ec (svn r1082) Feature: Chat toolbar
dominik
parents: 624
diff changeset
  1971
6531
4445b25832c4 (svn r9719) -Fix: in-game private messages did not work for clients with a Client ID > 255.
rubidium
parents: 6492
diff changeset
  1972
void ShowNetworkChatQueryWindow(DestType type, int dest)
649
bc9bdefb76ec (svn r1082) Feature: Chat toolbar
dominik
parents: 624
diff changeset
  1973
{
bc9bdefb76ec (svn r1082) Feature: Chat toolbar
dominik
parents: 624
diff changeset
  1974
	DeleteWindowById(WC_SEND_NETWORK_MSG, 0);
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1975
	new NetworkChatWindow (&_chat_window_desc, type, dest);
649
bc9bdefb76ec (svn r1082) Feature: Chat toolbar
dominik
parents: 624
diff changeset
  1976
}
bc9bdefb76ec (svn r1082) Feature: Chat toolbar
dominik
parents: 624
diff changeset
  1977
7998
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  1978
/** Enum for NetworkGameWindow, referring to _network_game_window_widgets */
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  1979
enum NetworkCompanyPasswordWindowWidgets {
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  1980
	NCPWW_CLOSE,                    ///< Close 'X' button
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  1981
	NCPWW_CAPTION,                  ///< Caption of the whole window
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  1982
	NCPWW_BACKGROUND,               ///< The background of the interface
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  1983
	NCPWW_LABEL,                    ///< Label in front of the password field
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  1984
	NCPWW_PASSWORD,                 ///< Input field for the password
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  1985
	NCPWW_SAVE_AS_DEFAULT_PASSWORD, ///< Toggle 'button' for saving the current password as default password
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  1986
	NCPWW_CANCEL,                   ///< Close the window without changing anything
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  1987
	NCPWW_OK,                       ///< Safe the password etc.
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  1988
};
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  1989
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1990
struct NetworkCompanyPasswordWindow : public QueryStringBaseWindow {
9241
93e9c7c074cc (svn r13107) -Codechange: make NetworkCompanyPasswordWindow and SelectPlayerFaceWindow children of PlayerCompanyWindow.
glx
parents: 9182
diff changeset
  1991
	NetworkCompanyPasswordWindow(const WindowDesc *desc, Window *parent) : QueryStringBaseWindow(desc)
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1992
	{
9241
93e9c7c074cc (svn r13107) -Codechange: make NetworkCompanyPasswordWindow and SelectPlayerFaceWindow children of PlayerCompanyWindow.
glx
parents: 9182
diff changeset
  1993
		this->parent = parent;
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1994
		this->afilter = CS_ALPHANUMERAL;
9420
8a38703928e8 (svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents: 9416
diff changeset
  1995
		InitializeTextBuffer(&this->text, this->edit_str_buf, min(lengthof(_settings_client.network.default_company_pass), lengthof(this->edit_str_buf)), 0);
7998
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  1996
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1997
		this->FindWindowPlacementAndResize(desc);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  1998
	}
7998
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  1999
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2000
	void OnOk()
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2001
	{
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2002
		if (this->IsWidgetLowered(NCPWW_SAVE_AS_DEFAULT_PASSWORD)) {
9420
8a38703928e8 (svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents: 9416
diff changeset
  2003
			snprintf(_settings_client.network.default_company_pass, lengthof(_settings_client.network.default_company_pass), "%s", this->edit_str_buf);
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2004
		}
8087
25e5cc4a5344 (svn r11648) -Fix [FS#1560]: the company password was not set when one pressed the enter key.
rubidium
parents: 8082
diff changeset
  2005
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2006
		/* empty password is a '*' because of console argument */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2007
		if (StrEmpty(this->edit_str_buf)) snprintf(this->edit_str_buf, lengthof(this->edit_str_buf), "*");
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2008
		char *password = this->edit_str_buf;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2009
		NetworkChangeCompanyPassword(1, &password);
7998
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  2010
	}
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2011
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2012
	virtual void OnPaint()
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2013
	{
9273
35e0224ea8f1 (svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents: 9269
diff changeset
  2014
		this->DrawWidgets();
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2015
		this->DrawEditBox(4);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2016
	}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2017
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2018
	virtual void OnClick(Point pt, int widget)
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2019
	{
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2020
		switch (widget) {
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2021
			case NCPWW_OK:
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2022
				this->OnOk();
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2023
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2024
			/* FALL THROUGH */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2025
			case NCPWW_CANCEL:
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2026
				delete this;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2027
				break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2028
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2029
			case NCPWW_SAVE_AS_DEFAULT_PASSWORD:
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2030
				this->ToggleWidgetLoweredState(NCPWW_SAVE_AS_DEFAULT_PASSWORD);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2031
				this->SetDirty();
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2032
				break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2033
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2034
			case NCPWW_PASSWORD:
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2035
				ShowOnScreenKeyboard(this, NCPWW_PASSWORD, 2, 1);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2036
				break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2037
		}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2038
	}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2039
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2040
	virtual void OnMouseLoop()
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2041
	{
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2042
		this->HandleEditBox(4);
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2043
	}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2044
9285
235e5e2d7f55 (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: 9274
diff changeset
  2045
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2046
	{
9285
235e5e2d7f55 (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: 9274
diff changeset
  2047
		EventState state;
235e5e2d7f55 (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: 9274
diff changeset
  2048
		switch (this->HandleEditBoxKey(4, key, keycode, state)) {
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2049
			case 1: // Return
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2050
				this->OnOk();
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2051
				/* FALL THROUGH */
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2052
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2053
			case 2: // Escape
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2054
				delete this;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2055
				break;
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2056
		}
9285
235e5e2d7f55 (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: 9274
diff changeset
  2057
		return state;
9179
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2058
	}
780666b686ed (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 9178
diff changeset
  2059
};
7998
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  2060
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  2061
static const Widget _ncp_window_widgets[] = {
9827
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  2062
{   WWT_CLOSEBOX,  RESIZE_NONE,  COLOUR_GREY,   0,  10,  0, 13, STR_00C5,                          STR_018B_CLOSE_WINDOW},
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  2063
{    WWT_CAPTION,  RESIZE_NONE,  COLOUR_GREY,  11, 299,  0, 13, STR_COMPANY_PASSWORD_CAPTION,      STR_018C_WINDOW_TITLE_DRAG_THIS},
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  2064
{      WWT_PANEL,  RESIZE_NONE,  COLOUR_GREY,   0, 299, 14, 50, 0x0,                               STR_NULL},
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  2065
{       WWT_TEXT,  RESIZE_NONE,  COLOUR_GREY,   5, 100, 19, 30, STR_COMPANY_PASSWORD,              STR_NULL},
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  2066
{    WWT_EDITBOX,  RESIZE_NONE,  COLOUR_GREY, 101, 294, 19, 30, STR_SET_COMPANY_PASSWORD,          STR_NULL},
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  2067
{    WWT_TEXTBTN,  RESIZE_NONE,  COLOUR_GREY, 101, 294, 35, 46, STR_MAKE_DEFAULT_COMPANY_PASSWORD, STR_MAKE_DEFAULT_COMPANY_PASSWORD_TIP},
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  2068
{ WWT_PUSHTXTBTN,  RESIZE_NONE,  COLOUR_GREY,   0, 149, 51, 62, STR_012E_CANCEL,                   STR_COMPANY_PASSWORD_CANCEL},
338aac16d11b (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents: 9770
diff changeset
  2069
{ WWT_PUSHTXTBTN,  RESIZE_NONE,  COLOUR_GREY, 150, 299, 51, 62, STR_012F_OK,                       STR_COMPANY_PASSWORD_OK},
7998
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  2070
{   WIDGETS_END},
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  2071
};
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  2072
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  2073
static const WindowDesc _ncp_window_desc = {
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  2074
	WDP_AUTO, WDP_AUTO, 300, 63, 300, 63,
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  2075
	WC_COMPANY_PASSWORD_WINDOW, WC_NONE,
8019
fc0e94dee165 (svn r11579) -Revert(r11578): some cases of key propagation are not handled correctly.
belugas
parents: 8018
diff changeset
  2076
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON,
7998
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  2077
	_ncp_window_widgets,
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  2078
};
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  2079
9241
93e9c7c074cc (svn r13107) -Codechange: make NetworkCompanyPasswordWindow and SelectPlayerFaceWindow children of PlayerCompanyWindow.
glx
parents: 9182
diff changeset
  2080
void ShowNetworkCompanyPasswordWindow(Window *parent)
7998
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  2081
{
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  2082
	DeleteWindowById(WC_COMPANY_PASSWORD_WINDOW, 0);
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  2083
9241
93e9c7c074cc (svn r13107) -Codechange: make NetworkCompanyPasswordWindow and SelectPlayerFaceWindow children of PlayerCompanyWindow.
glx
parents: 9182
diff changeset
  2084
	new NetworkCompanyPasswordWindow(&_ncp_window_desc, parent);
7998
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  2085
}
9cf9f9153262 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 7997
diff changeset
  2086
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  2087
#endif /* ENABLE_NETWORK */