author | rubidium |
Tue, 03 Jun 2008 08:04:35 +0000 | |
changeset 10818 | 95a5bba4e812 |
parent 10808 | d42b140d24f2 |
child 10830 | 6f77385d473b |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
10429
1b99254f9607
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents:
10178
diff
changeset
|
3 |
/** @file network_gui.cpp Implementation of the Network related GUIs. */ |
1b99254f9607
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents:
10178
diff
changeset
|
4 |
|
4826
63b1eb7c966b
(svn r6750) -Codechange: Juggle around some header includes as they're only used when
Darkvater
parents:
4774
diff
changeset
|
5 |
#ifdef ENABLE_NETWORK |
5720
cc0ceeafaa55
(svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents:
5683
diff
changeset
|
6 |
#include "../stdafx.h" |
cc0ceeafaa55
(svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents:
5683
diff
changeset
|
7 |
#include "../openttd.h" |
8610
17cc343a23dd
(svn r11675) -Codechange: split the string types from the string functions.
rubidium
parents:
8603
diff
changeset
|
8 |
#include "../strings_func.h" |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
9 |
#include "network.h" |
8636
2b158acb649c
(svn r11702) -Codechange: move all date related stuff to date*.
rubidium
parents:
8627
diff
changeset
|
10 |
#include "../date_func.h" |
5720
cc0ceeafaa55
(svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents:
5683
diff
changeset
|
11 |
#include "../fios.h" |
10792
95b6eb9fcc9e
(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:
10784
diff
changeset
|
12 |
#include "network_internal.h" |
4013
a11adcc2a852
(svn r5226) Reduce the mess that sending chat messages is
tron
parents:
3860
diff
changeset
|
13 |
#include "network_client.h" |
4826
63b1eb7c966b
(svn r6750) -Codechange: Juggle around some header includes as they're only used when
Darkvater
parents:
4774
diff
changeset
|
14 |
#include "network_gui.h" |
738
0b2fb79e64fc
(svn r1194) Feature: You can now add and remove servers from the server list. Those will be remembered until you delete them by pressing the Delete key.
dominik
parents:
735
diff
changeset
|
15 |
#include "network_gamelist.h" |
5720
cc0ceeafaa55
(svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents:
5683
diff
changeset
|
16 |
#include "../gui.h" |
8603
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
17 |
#include "../window_gui.h" |
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
18 |
#include "../textbuf_gui.h" |
5720
cc0ceeafaa55
(svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents:
5683
diff
changeset
|
19 |
#include "../variables.h" |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
20 |
#include "network_server.h" |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
21 |
#include "network_udp.h" |
5720
cc0ceeafaa55
(svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents:
5683
diff
changeset
|
22 |
#include "../town.h" |
cc0ceeafaa55
(svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents:
5683
diff
changeset
|
23 |
#include "../newgrf.h" |
8627
448ebf3a8291
(svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium
parents:
8626
diff
changeset
|
24 |
#include "../functions.h" |
448ebf3a8291
(svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium
parents:
8626
diff
changeset
|
25 |
#include "../window_func.h" |
8709
4187ad809fe7
(svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium
parents:
8704
diff
changeset
|
26 |
#include "../core/alloc_func.hpp" |
8710
52015340050c
(svn r11777) -Codechange: split the string header and make do not include it when it's not necessary.
rubidium
parents:
8709
diff
changeset
|
27 |
#include "../string_func.h" |
8720
4e60c30e2006
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8710
diff
changeset
|
28 |
#include "../gfx_func.h" |
8750
fdd6054e7bae
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
8720
diff
changeset
|
29 |
#include "../player_func.h" |
8766
c86cfa3a7580
(svn r11834) -Codechange: only include settings_type.h if needed.
rubidium
parents:
8760
diff
changeset
|
30 |
#include "../settings_type.h" |
8780
6f3f3ec6c69a
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
8766
diff
changeset
|
31 |
#include "../widgets/dropdown_func.h" |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
32 |
#include "../querystring_gui.h" |
10596
0ee9eba64c9c
(svn r13140) -Codechange: move the gui-list-sorting out of window_gui.h so window_gui.h only needs to be included in *_gui.cpp.
rubidium
parents:
10595
diff
changeset
|
33 |
#include "../sortlist_type.h" |
0 | 34 |
|
8760
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8750
diff
changeset
|
35 |
#include "table/strings.h" |
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8750
diff
changeset
|
36 |
#include "../table/sprites.h" |
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8750
diff
changeset
|
37 |
|
0 | 38 |
#define BGC 5 |
39 |
#define BTC 15 |
|
2887
d5967e472eee
(svn r3439) - CodeChange: Remove a whole bunch of global variables and put them into the WP() macro. Also combine more than one WP-custom element. For this the maximum size of w->custom (WP) has been increased, and multiple types put inside one with possibly moved to the corresponding gui file if it is only used there.
Darkvater
parents:
2886
diff
changeset
|
40 |
|
4315
a0fc451fad6b
(svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents:
4300
diff
changeset
|
41 |
static bool _chat_tab_completion_active; |
3470
9dc3e8d2fde1
(svn r4315) Remove MAX_QUERYSTR_LEN, rather use lengthof() the real thing
tron
parents:
3469
diff
changeset
|
42 |
|
6573 | 43 |
static void ShowNetworkStartServerWindow(); |
2887
d5967e472eee
(svn r3439) - CodeChange: Remove a whole bunch of global variables and put them into the WP() macro. Also combine more than one WP-custom element. For this the maximum size of w->custom (WP) has been increased, and multiple types put inside one with possibly moved to the corresponding gui file if it is only used there.
Darkvater
parents:
2886
diff
changeset
|
44 |
static void ShowNetworkLobbyWindow(NetworkGameList *ngl); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
45 |
extern void SwitchMode(int new_mode); |
0 | 46 |
|
47 |
static const StringID _connection_types_dropdown[] = { |
|
675
b120ec0b3e39
(svn r1113) -Add: [Network] Added the GUI part for server advertising. When you go
truelight
parents:
670
diff
changeset
|
48 |
STR_NETWORK_LAN_INTERNET, |
b120ec0b3e39
(svn r1113) -Add: [Network] Added the GUI part for server advertising. When you go
truelight
parents:
670
diff
changeset
|
49 |
STR_NETWORK_INTERNET_ADVERTISE, |
0 | 50 |
INVALID_STRING_ID |
51 |
}; |
|
52 |
||
764
68b398e2b780
(svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents:
749
diff
changeset
|
53 |
static const StringID _lan_internet_types_dropdown[] = { |
68b398e2b780
(svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents:
749
diff
changeset
|
54 |
STR_NETWORK_LAN, |
68b398e2b780
(svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents:
749
diff
changeset
|
55 |
STR_NETWORK_INTERNET, |
68b398e2b780
(svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents:
749
diff
changeset
|
56 |
INVALID_STRING_ID |
68b398e2b780
(svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents:
749
diff
changeset
|
57 |
}; |
68b398e2b780
(svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents:
749
diff
changeset
|
58 |
|
7292
d4cf2baf26ae
(svn r10035) -Change: simplified network language string sorting
glx
parents:
7289
diff
changeset
|
59 |
static StringID _language_dropdown[NETLANG_COUNT + 1] = {STR_NULL}; |
7289
d6a004877931
(svn r10032) -Add: sort the strings in server language dropdown
glx
parents:
7276
diff
changeset
|
60 |
|
7817
f24498d934ac
(svn r10684) -Codechange: some more coding style related changes. Primarily moving { to a new line.
rubidium
parents:
7717
diff
changeset
|
61 |
void SortNetworkLanguages() |
f24498d934ac
(svn r10684) -Codechange: some more coding style related changes. Primarily moving { to a new line.
rubidium
parents:
7717
diff
changeset
|
62 |
{ |
7292
d4cf2baf26ae
(svn r10035) -Change: simplified network language string sorting
glx
parents:
7289
diff
changeset
|
63 |
/* Init the strings */ |
d4cf2baf26ae
(svn r10035) -Change: simplified network language string sorting
glx
parents:
7289
diff
changeset
|
64 |
if (_language_dropdown[0] == STR_NULL) { |
d4cf2baf26ae
(svn r10035) -Change: simplified network language string sorting
glx
parents:
7289
diff
changeset
|
65 |
for (int i = 0; i < NETLANG_COUNT; i++) _language_dropdown[i] = STR_NETWORK_LANG_ANY + i; |
d4cf2baf26ae
(svn r10035) -Change: simplified network language string sorting
glx
parents:
7289
diff
changeset
|
66 |
_language_dropdown[NETLANG_COUNT] = INVALID_STRING_ID; |
d4cf2baf26ae
(svn r10035) -Change: simplified network language string sorting
glx
parents:
7289
diff
changeset
|
67 |
} |
7289
d6a004877931
(svn r10032) -Add: sort the strings in server language dropdown
glx
parents:
7276
diff
changeset
|
68 |
|
7292
d4cf2baf26ae
(svn r10035) -Change: simplified network language string sorting
glx
parents:
7289
diff
changeset
|
69 |
/* Sort the strings (we don't move 'any' and the 'invalid' one) */ |
d4cf2baf26ae
(svn r10035) -Change: simplified network language string sorting
glx
parents:
7289
diff
changeset
|
70 |
qsort(&_language_dropdown[1], NETLANG_COUNT - 1, sizeof(StringID), &StringIDSorter); |
7289
d6a004877931
(svn r10032) -Add: sort the strings in server language dropdown
glx
parents:
7276
diff
changeset
|
71 |
} |
7276
fdb2191fac67
(svn r10017) -Add (FS#790): more languages flags for servers
glx
parents:
7027
diff
changeset
|
72 |
|
211 | 73 |
enum { |
2881
1ffbbdbf1685
(svn r3429) - Feature (Followup): Change the gamelist window to accomodate for the new information.
Darkvater
parents:
2879
diff
changeset
|
74 |
NET_PRC__OFFSET_TOP_WIDGET = 54, |
2887
d5967e472eee
(svn r3439) - CodeChange: Remove a whole bunch of global variables and put them into the WP() macro. Also combine more than one WP-custom element. For this the maximum size of w->custom (WP) has been increased, and multiple types put inside one with possibly moved to the corresponding gui file if it is only used there.
Darkvater
parents:
2886
diff
changeset
|
75 |
NET_PRC__OFFSET_TOP_WIDGET_COMPANY = 52, |
2881
1ffbbdbf1685
(svn r3429) - Feature (Followup): Change the gamelist window to accomodate for the new information.
Darkvater
parents:
2879
diff
changeset
|
76 |
NET_PRC__SIZE_OF_ROW = 14, |
211 | 77 |
}; |
78 |
||
5035
e5680cce4e67
(svn r7077) -Codechange: Send proper message to network window, and handle selection control in
Darkvater
parents:
4957
diff
changeset
|
79 |
/** Update the network new window because a new server is |
e5680cce4e67
(svn r7077) -Codechange: Send proper message to network window, and handle selection control in
Darkvater
parents:
4957
diff
changeset
|
80 |
* found on the network. |
e5680cce4e67
(svn r7077) -Codechange: Send proper message to network window, and handle selection control in
Darkvater
parents:
4957
diff
changeset
|
81 |
* @param unselect unselect the currently selected item */ |
897
42412d5ecc64
(svn r1383) Fix: You can now also delete automatically found servers by pressing "del"
dominik
parents:
893
diff
changeset
|
82 |
void UpdateNetworkGameWindow(bool unselect) |
42412d5ecc64
(svn r1383) Fix: You can now also delete automatically found servers by pressing "del"
dominik
parents:
893
diff
changeset
|
83 |
{ |
10485
331014dcd0d3
(svn r13028) -Codechange: WE_MESSAGE and WE_INVALIDATE_DATA were doing the same thing.
rubidium
parents:
10484
diff
changeset
|
84 |
InvalidateWindowData(WC_NETWORK_WINDOW, 0, unselect); |
897
42412d5ecc64
(svn r1383) Fix: You can now also delete automatically found servers by pressing "del"
dominik
parents:
893
diff
changeset
|
85 |
} |
42412d5ecc64
(svn r1383) Fix: You can now also delete automatically found servers by pressing "del"
dominik
parents:
893
diff
changeset
|
86 |
|
8456
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
87 |
/** Enum for NetworkGameWindow, referring to _network_game_window_widgets */ |
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
88 |
enum NetworkGameWindowWidgets { |
10170
39c950e2ab9d
(svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents:
9234
diff
changeset
|
89 |
NGWW_CLOSE, ///< Close 'X' button |
39c950e2ab9d
(svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents:
9234
diff
changeset
|
90 |
NGWW_CAPTION, ///< Caption of the window |
39c950e2ab9d
(svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents:
9234
diff
changeset
|
91 |
NGWW_RESIZE, ///< Resize button |
8456
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
92 |
|
10170
39c950e2ab9d
(svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents:
9234
diff
changeset
|
93 |
NGWW_CONNECTION, ///< Label in from of connection droplist |
39c950e2ab9d
(svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents:
9234
diff
changeset
|
94 |
NGWW_CONN_BTN, ///< 'Connection' droplist button |
39c950e2ab9d
(svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents:
9234
diff
changeset
|
95 |
NGWW_PLAYER, ///< Panel with editbox to set player name |
39c950e2ab9d
(svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents:
9234
diff
changeset
|
96 |
|
39c950e2ab9d
(svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents:
9234
diff
changeset
|
97 |
NGWW_NAME, ///< 'Name' button |
8456
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
98 |
NGWW_CLIENTS, ///< 'Clients' button |
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
99 |
NGWW_INFO, ///< Third button in the game list panel |
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
100 |
|
10170
39c950e2ab9d
(svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents:
9234
diff
changeset
|
101 |
NGWW_MATRIX, ///< Panel with list of games |
39c950e2ab9d
(svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents:
9234
diff
changeset
|
102 |
NGWW_SCROLLBAR, ///< Scrollbar of matrix |
8456
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
103 |
|
10178
8fde48e0ddac
(svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium
parents:
10170
diff
changeset
|
104 |
NGWW_LASTJOINED_LABEL, ///< Label "Last joined server:" |
8fde48e0ddac
(svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium
parents:
10170
diff
changeset
|
105 |
NGWW_LASTJOINED, ///< Info about the last joined server |
8fde48e0ddac
(svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium
parents:
10170
diff
changeset
|
106 |
|
10170
39c950e2ab9d
(svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents:
9234
diff
changeset
|
107 |
NGWW_DETAILS, ///< Panel with game details |
39c950e2ab9d
(svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents:
9234
diff
changeset
|
108 |
NGWW_JOIN, ///< 'Join game' button |
39c950e2ab9d
(svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents:
9234
diff
changeset
|
109 |
NGWW_REFRESH, ///< 'Refresh server' button |
39c950e2ab9d
(svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents:
9234
diff
changeset
|
110 |
NGWW_NEWGRF, ///< 'NewGRF Settings' button |
8456
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
111 |
|
10170
39c950e2ab9d
(svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents:
9234
diff
changeset
|
112 |
NGWW_FIND, ///< 'Find server' button |
8456
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
113 |
NGWW_ADD, ///< 'Add server' button |
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
114 |
NGWW_START, ///< 'Start server' button |
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
115 |
NGWW_CANCEL, ///< 'Cancel' button |
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
116 |
}; |
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
117 |
|
10502
996d9308d650
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents:
10501
diff
changeset
|
118 |
typedef GUIList<NetworkGameList*> GUIGameServerList; |
996d9308d650
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents:
10501
diff
changeset
|
119 |
|
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
120 |
class NetworkGameWindow : public QueryStringBaseWindow { |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
121 |
protected: |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
122 |
/* Runtime saved values */ |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
123 |
static Listing last_sorting; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
124 |
|
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
125 |
/* Constants for sorting servers */ |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
126 |
static GUIGameServerList::SortFunction *const sorter_funcs[]; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
127 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
128 |
byte field; ///< selected text-field |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
129 |
NetworkGameList *server; ///< selected server |
10502
996d9308d650
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents:
10501
diff
changeset
|
130 |
GUIGameServerList servers; ///< list with game servers. |
0 | 131 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
132 |
/** |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
133 |
* (Re)build the network game list as its amount has changed because |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
134 |
* an item has been added or deleted for example |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
135 |
*/ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
136 |
void BuildNetworkGameList() |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
137 |
{ |
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
138 |
if (!this->servers.NeedRebuild()) return; |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
139 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
140 |
/* Create temporary array of games to use for listing */ |
10716
2406d1520245
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
10703
diff
changeset
|
141 |
this->servers.Clear(); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
142 |
|
10716
2406d1520245
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
10703
diff
changeset
|
143 |
for (NetworkGameList *ngl = _network_game_list; ngl != NULL; ngl = ngl->next) { |
2406d1520245
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
10703
diff
changeset
|
144 |
*this->servers.Append() = ngl; |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
145 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
146 |
|
10716
2406d1520245
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
10703
diff
changeset
|
147 |
this->servers.Compact(); |
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
148 |
this->servers.RebuildDone(); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
149 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
150 |
|
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
151 |
/** Sort servers by name. */ |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
152 |
static int CDECL NGameNameSorter(NetworkGameList* const *a, NetworkGameList* const *b) |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
153 |
{ |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
154 |
return strcasecmp((*a)->info.server_name, (*b)->info.server_name); |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
155 |
} |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
156 |
|
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
157 |
/** Sort servers by the amount of clients online on a |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
158 |
* server. If the two servers have the same amount, the one with the |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
159 |
* higher maximum is preferred. */ |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
160 |
static int CDECL NGameClientSorter(NetworkGameList* const *a, NetworkGameList* const *b) |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
161 |
{ |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
162 |
/* Reverse as per default we are interested in most-clients first */ |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
163 |
int r = (*a)->info.clients_on - (*b)->info.clients_on; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
164 |
|
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
165 |
if (r == 0) r = (*a)->info.clients_max - (*b)->info.clients_max; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
166 |
if (r == 0) r = NGameNameSorter(a, b); |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
167 |
|
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
168 |
return r; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
169 |
} |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
170 |
|
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
171 |
/** Sort servers by joinability. If both servers are the |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
172 |
* same, prefer the non-passworded server first. */ |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
173 |
static int CDECL NGameAllowedSorter(NetworkGameList* const *a, NetworkGameList* const *b) |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
174 |
{ |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
175 |
/* The servers we do not know anything about (the ones that did not reply) should be at the bottom) */ |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
176 |
int r = StrEmpty((*a)->info.server_revision) - StrEmpty((*b)->info.server_revision); |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
177 |
|
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
178 |
/* Reverse default as we are interested in version-compatible clients first */ |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
179 |
if (r == 0) r = (*b)->info.version_compatible - (*a)->info.version_compatible; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
180 |
/* The version-compatible ones are then sorted with NewGRF compatible first, incompatible last */ |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
181 |
if (r == 0) r = (*b)->info.compatible - (*a)->info.compatible; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
182 |
/* Passworded servers should be below unpassworded servers */ |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
183 |
if (r == 0) r = (*a)->info.use_password - (*b)->info.use_password; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
184 |
/* Finally sort on the name of the server */ |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
185 |
if (r == 0) r = NGameNameSorter(a, b); |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
186 |
|
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
187 |
return r; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
188 |
} |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
189 |
|
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
190 |
/** Sort the server list */ |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
191 |
void SortNetworkGameList() |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
192 |
{ |
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
193 |
if (!this->servers.Sort()) return; |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
194 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
195 |
/* After sorting ngl->sort_list contains the sorted items. Put these back |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
196 |
* into the original list. Basically nothing has changed, we are only |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
197 |
* shuffling the ->next pointers */ |
10716
2406d1520245
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
10703
diff
changeset
|
198 |
_network_game_list = this->servers[0]; |
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
199 |
NetworkGameList *item = _network_game_list; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
200 |
for (uint i = 1; i != this->servers.Length(); i++) { |
10716
2406d1520245
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
10703
diff
changeset
|
201 |
item->next = this->servers[i]; |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
202 |
item = item->next; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
203 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
204 |
item->next = NULL; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
205 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
206 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
207 |
/** |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
208 |
* Draw a single server line. |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
209 |
* @param cur_item the server to draw. |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
210 |
* @param y from where to draw? |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
211 |
* @param highlight does the line need to be highlighted? |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
212 |
*/ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
213 |
void DrawServerLine(const NetworkGameList *cur_item, uint y, bool highlight) |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
214 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
215 |
/* show highlighted item with a different colour */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
216 |
if (highlight) GfxFillRect(this->widget[NGWW_NAME].left + 1, y - 2, this->widget[NGWW_INFO].right - 1, y + 9, 10); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
217 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
218 |
SetDParamStr(0, cur_item->info.server_name); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
219 |
DrawStringTruncated(this->widget[NGWW_NAME].left + 5, y, STR_02BD, TC_BLACK, this->widget[NGWW_NAME].right - this->widget[NGWW_NAME].left - 5); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
220 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
221 |
SetDParam(0, cur_item->info.clients_on); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
222 |
SetDParam(1, cur_item->info.clients_max); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
223 |
SetDParam(2, cur_item->info.companies_on); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
224 |
SetDParam(3, cur_item->info.companies_max); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
225 |
DrawStringCentered(this->widget[NGWW_CLIENTS].left + 39, y, STR_NETWORK_GENERAL_ONLINE, TC_GOLD); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
226 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
227 |
/* only draw icons if the server is online */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
228 |
if (cur_item->online) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
229 |
/* draw a lock if the server is password protected */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
230 |
if (cur_item->info.use_password) DrawSprite(SPR_LOCK, PAL_NONE, this->widget[NGWW_INFO].left + 5, y - 1); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
231 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
232 |
/* draw red or green icon, depending on compatibility with server */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
233 |
DrawSprite(SPR_BLOT, (cur_item->info.compatible ? PALETTE_TO_GREEN : (cur_item->info.version_compatible ? PALETTE_TO_YELLOW : PALETTE_TO_RED)), this->widget[NGWW_INFO].left + 15, y); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
234 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
235 |
/* draw flag according to server language */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
236 |
DrawSprite(SPR_FLAGS_BASE + cur_item->info.server_lang, PAL_NONE, this->widget[NGWW_INFO].left + 25, y); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
237 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
238 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
239 |
|
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
240 |
public: |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
241 |
NetworkGameWindow(const WindowDesc *desc) : QueryStringBaseWindow(desc) |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
242 |
{ |
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
243 |
ttd_strlcpy(this->edit_str_buf, _settings_client.network.player_name, lengthof(this->edit_str_buf)); |
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
244 |
this->afilter = CS_ALPHANUMERAL; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
245 |
InitializeTextBuffer(&this->text, this->edit_str_buf, lengthof(this->edit_str_buf), 120); |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
246 |
|
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
247 |
UpdateNetworkGameWindow(true); |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
248 |
|
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
249 |
this->vscroll.cap = 11; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
250 |
this->resize.step_height = NET_PRC__SIZE_OF_ROW; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
251 |
|
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
252 |
this->field = NGWW_PLAYER; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
253 |
this->server = NULL; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
254 |
|
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
255 |
this->servers.SetListing(this->last_sorting); |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
256 |
this->servers.SetSortFuncs(this->sorter_funcs); |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
257 |
this->servers.ForceRebuild(); |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
258 |
this->SortNetworkGameList(); |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
259 |
|
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
260 |
this->FindWindowPlacementAndResize(desc); |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
261 |
} |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
262 |
|
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
263 |
~NetworkGameWindow() |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
264 |
{ |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
265 |
this->last_sorting = this->servers.GetListing(); |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
266 |
} |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
267 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
268 |
virtual void OnPaint() |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
269 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
270 |
const NetworkGameList *sel = this->server; |
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
271 |
const SortButtonState arrow = this->servers.IsDescSortOrder() ? SBS_DOWN : SBS_UP; |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
272 |
|
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
273 |
if (this->servers.NeedRebuild()) { |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
274 |
this->BuildNetworkGameList(); |
10716
2406d1520245
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
10703
diff
changeset
|
275 |
SetVScrollCount(this, this->servers.Length()); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
276 |
} |
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
277 |
this->SortNetworkGameList(); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
278 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
279 |
/* 'Refresh' button invisible if no server selected */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
280 |
this->SetWidgetDisabledState(NGWW_REFRESH, sel == NULL); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
281 |
/* 'Join' button disabling conditions */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
282 |
this->SetWidgetDisabledState(NGWW_JOIN, sel == NULL || // no Selected Server |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
283 |
!sel->online || // Server offline |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
284 |
sel->info.clients_on >= sel->info.clients_max || // Server full |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
285 |
!sel->info.compatible); // Revision mismatch |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
286 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
287 |
/* 'NewGRF Settings' button invisible if no NewGRF is used */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
288 |
this->SetWidgetHiddenState(NGWW_NEWGRF, sel == NULL || |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
289 |
!sel->online || |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
290 |
sel->info.grfconfig == NULL); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
291 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
292 |
SetDParam(0, 0x00); |
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
293 |
SetDParam(1, _lan_internet_types_dropdown[_settings_client.network.lan_internet]); |
10595
7957c71b0dfe
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
10591
diff
changeset
|
294 |
this->DrawWidgets(); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
295 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
296 |
/* Edit box to set player name */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
297 |
this->DrawEditBox(NGWW_PLAYER); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
298 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
299 |
DrawString(this->widget[NGWW_PLAYER].left - 100, 23, STR_NETWORK_PLAYER_NAME, TC_GOLD); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
300 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
301 |
/* Sort based on widgets: name, clients, compatibility */ |
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
302 |
switch (this->servers.SortType()) { |
10595
7957c71b0dfe
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
10591
diff
changeset
|
303 |
case NGWW_NAME - NGWW_NAME: this->DrawSortButtonState(NGWW_NAME, arrow); break; |
7957c71b0dfe
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
10591
diff
changeset
|
304 |
case NGWW_CLIENTS - NGWW_NAME: this->DrawSortButtonState(NGWW_CLIENTS, arrow); break; |
7957c71b0dfe
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
10591
diff
changeset
|
305 |
case NGWW_INFO - NGWW_NAME: this->DrawSortButtonState(NGWW_INFO, arrow); break; |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
306 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
307 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
308 |
uint16 y = NET_PRC__OFFSET_TOP_WIDGET + 3; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
309 |
|
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
310 |
const int max = min(this->vscroll.pos + this->vscroll.cap, this->servers.Length()); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
311 |
|
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
312 |
for (int i = this->vscroll.pos; i < max; ++i) { |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
313 |
const NetworkGameList *ngl = this->servers[i]; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
314 |
this->DrawServerLine(ngl, y, ngl == sel); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
315 |
y += NET_PRC__SIZE_OF_ROW; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
316 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
317 |
|
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
318 |
const NetworkGameList *last_joined = NetworkGameListAddItem(inet_addr(_settings_client.network.last_host), _settings_client.network.last_port); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
319 |
/* Draw the last joined server, if any */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
320 |
if (last_joined != NULL) this->DrawServerLine(last_joined, y = this->widget[NGWW_LASTJOINED].top + 3, last_joined == sel); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
321 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
322 |
/* Draw the right menu */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
323 |
GfxFillRect(this->widget[NGWW_DETAILS].left + 1, 43, this->widget[NGWW_DETAILS].right - 1, 92, 157); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
324 |
if (sel == NULL) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
325 |
DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, 58, STR_NETWORK_GAME_INFO, TC_FROMSTRING); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
326 |
} else if (!sel->online) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
327 |
SetDParamStr(0, sel->info.server_name); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
328 |
DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, 68, STR_ORANGE, TC_FROMSTRING); // game name |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
329 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
330 |
DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, 132, STR_NETWORK_SERVER_OFFLINE, TC_FROMSTRING); // server offline |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
331 |
} else { // show game info |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
332 |
uint16 y = 100; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
333 |
const uint16 x = this->widget[NGWW_DETAILS].left + 5; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
334 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
335 |
DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, 48, STR_NETWORK_GAME_INFO, TC_FROMSTRING); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
336 |
|
2055
9361b56db8ba
(svn r2564) Fix: Fixed conceptual issue in network_gui.c. AllocateName is not meant to be used by GUI-code, because it modifies the "game-state".
ludde
parents:
1916
diff
changeset
|
337 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
338 |
SetDParamStr(0, sel->info.server_name); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
339 |
DrawStringCenteredTruncated(this->widget[NGWW_DETAILS].left, this->widget[NGWW_DETAILS].right, 62, STR_ORANGE, TC_BLACK); // game name |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
340 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
341 |
SetDParamStr(0, sel->info.map_name); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
342 |
DrawStringCenteredTruncated(this->widget[NGWW_DETAILS].left, this->widget[NGWW_DETAILS].right, 74, STR_02BD, TC_BLACK); // map name |
10178
8fde48e0ddac
(svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium
parents:
10170
diff
changeset
|
343 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
344 |
SetDParam(0, sel->info.clients_on); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
345 |
SetDParam(1, sel->info.clients_max); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
346 |
SetDParam(2, sel->info.companies_on); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
347 |
SetDParam(3, sel->info.companies_max); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
348 |
DrawString(x, y, STR_NETWORK_CLIENTS, TC_GOLD); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
349 |
y += 10; |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
350 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
351 |
SetDParam(0, STR_NETWORK_LANG_ANY + sel->info.server_lang); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
352 |
DrawString(x, y, STR_NETWORK_LANGUAGE, TC_GOLD); // server language |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
353 |
y += 10; |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
354 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
355 |
SetDParam(0, STR_TEMPERATE_LANDSCAPE + sel->info.map_set); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
356 |
DrawString(x, y, STR_NETWORK_TILESET, TC_GOLD); // tileset |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
357 |
y += 10; |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
358 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
359 |
SetDParam(0, sel->info.map_width); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
360 |
SetDParam(1, sel->info.map_height); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
361 |
DrawString(x, y, STR_NETWORK_MAP_SIZE, TC_GOLD); // map size |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
362 |
y += 10; |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
363 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
364 |
SetDParamStr(0, sel->info.server_revision); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
365 |
DrawString(x, y, STR_NETWORK_SERVER_VERSION, TC_GOLD); // server version |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
366 |
y += 10; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
367 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
368 |
SetDParamStr(0, sel->info.hostname); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
369 |
SetDParam(1, sel->port); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
370 |
DrawString(x, y, STR_NETWORK_SERVER_ADDRESS, TC_GOLD); // server address |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
371 |
y += 10; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
372 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
373 |
SetDParam(0, sel->info.start_date); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
374 |
DrawString(x, y, STR_NETWORK_START_DATE, TC_GOLD); // start date |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
375 |
y += 10; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
376 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
377 |
SetDParam(0, sel->info.game_date); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
378 |
DrawString(x, y, STR_NETWORK_CURRENT_DATE, TC_GOLD); // current date |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
379 |
y += 10; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
380 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
381 |
y += 2; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
382 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
383 |
if (!sel->info.compatible) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
384 |
DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, y, sel->info.version_compatible ? STR_NETWORK_GRF_MISMATCH : STR_NETWORK_VERSION_MISMATCH, TC_FROMSTRING); // server mismatch |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
385 |
} else if (sel->info.clients_on == sel->info.clients_max) { |
10818
95a5bba4e812
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents:
10808
diff
changeset
|
386 |
/* Show: server full, when clients_on == max_clients */ |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
387 |
DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, y, STR_NETWORK_SERVER_FULL, TC_FROMSTRING); // server full |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
388 |
} else if (sel->info.use_password) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
389 |
DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, y, STR_NETWORK_PASSWORD, TC_FROMSTRING); // password warning |
2639 | 390 |
} |
659
a98c731921b4
(svn r1093) -Fix: Hopefully fixed windows revision issues once and for all. Removed globalness of _openttd_revision and put all such ifdefs into one place. If server has a revision only the same revisions can join; if the server has no revision everyone can join. I reckon this should be a server-side option to allow people to join or not to join.
darkvater
parents:
656
diff
changeset
|
391 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
392 |
y += 10; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
393 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
394 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
395 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
396 |
virtual void OnClick(Point pt, int widget) |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
397 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
398 |
this->field = widget; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
399 |
switch (widget) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
400 |
case NGWW_PLAYER: |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
401 |
ShowOnScreenKeyboard(this, NGWW_PLAYER, 0, 0); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
402 |
break; |
741
39a3958887c1
(svn r1197) -Fix: [GUI] in r1194 someone deleted too much code from WE_KEYPRESS. Now
truelight
parents:
738
diff
changeset
|
403 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
404 |
case NGWW_CANCEL: // Cancel button |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
405 |
DeleteWindowById(WC_NETWORK_WINDOW, 0); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
406 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
407 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
408 |
case NGWW_CONN_BTN: // 'Connection' droplist |
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
409 |
ShowDropDownMenu(this, _lan_internet_types_dropdown, _settings_client.network.lan_internet, NGWW_CONN_BTN, 0, 0); // do it for widget NSSW_CONN_BTN |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
410 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
411 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
412 |
case NGWW_NAME: // Sort by name |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
413 |
case NGWW_CLIENTS: // Sort by connected clients |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
414 |
case NGWW_INFO: // Connectivity (green dot) |
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
415 |
if (this->servers.SortType() == widget - NGWW_NAME) { |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
416 |
this->servers.ToggleSortOrder(); |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
417 |
} else { |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
418 |
this->servers.SetSortType(widget - NGWW_NAME); |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
419 |
this->servers.ForceResort(); |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
420 |
} |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
421 |
this->SetDirty(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
422 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
423 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
424 |
case NGWW_MATRIX: { // Matrix to show networkgames |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
425 |
uint32 id_v = (pt.y - NET_PRC__OFFSET_TOP_WIDGET) / NET_PRC__SIZE_OF_ROW; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
426 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
427 |
if (id_v >= this->vscroll.cap) return; // click out of bounds |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
428 |
id_v += this->vscroll.pos; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
429 |
|
10778
2a163fb5571f
(svn r13328) -Fix (r13327): Don't access an item when there isn't any
skidd13
parents:
10777
diff
changeset
|
430 |
this->server = (id_v < this->servers.Length()) ? this->servers[id_v] : NULL; |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
431 |
this->SetDirty(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
432 |
} break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
433 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
434 |
case NGWW_LASTJOINED: { |
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
435 |
NetworkGameList *last_joined = NetworkGameListAddItem(inet_addr(_settings_client.network.last_host), _settings_client.network.last_port); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
436 |
if (last_joined != NULL) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
437 |
this->server = last_joined; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
438 |
this->SetDirty(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
439 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
440 |
} break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
441 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
442 |
case NGWW_FIND: // Find server automatically |
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
443 |
switch (_settings_client.network.lan_internet) { |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
444 |
case 0: NetworkUDPSearchGame(); break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
445 |
case 1: NetworkUDPQueryMasterServer(); break; |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
446 |
} |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
447 |
break; |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
448 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
449 |
case NGWW_ADD: // Add a server |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
450 |
ShowQueryString( |
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
451 |
BindCString(_settings_client.network.connect_to_ip), |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
452 |
STR_NETWORK_ENTER_IP, |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
453 |
31 | 0x1000, // maximum number of characters OR |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
454 |
250, // characters up to this width pixels, whichever is satisfied first |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
455 |
this, CS_ALPHANUMERAL); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
456 |
break; |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
457 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
458 |
case NGWW_START: // Start server |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
459 |
ShowNetworkStartServerWindow(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
460 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
461 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
462 |
case NGWW_JOIN: // Join Game |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
463 |
if (this->server != NULL) { |
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
464 |
snprintf(_settings_client.network.last_host, sizeof(_settings_client.network.last_host), "%s", inet_ntoa(*(struct in_addr *)&this->server->ip)); |
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
465 |
_settings_client.network.last_port = this->server->port; |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
466 |
ShowNetworkLobbyWindow(this->server); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
467 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
468 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
469 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
470 |
case NGWW_REFRESH: // Refresh |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
471 |
if (this->server != NULL) NetworkUDPQueryServer(this->server->info.hostname, this->server->port); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
472 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
473 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
474 |
case NGWW_NEWGRF: // NewGRF Settings |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
475 |
if (this->server != NULL) ShowNewGRFSettings(false, false, false, &this->server->info.grfconfig); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
476 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
477 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
478 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
479 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
480 |
virtual void OnDropdownSelect(int widget, int index) |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
481 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
482 |
switch (widget) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
483 |
case NGWW_CONN_BTN: |
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
484 |
_settings_client.network.lan_internet = index; |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
485 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
486 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
487 |
default: |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
488 |
NOT_REACHED(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
489 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
490 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
491 |
this->SetDirty(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
492 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
493 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
494 |
virtual void OnMouseLoop() |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
495 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
496 |
if (this->field == NGWW_PLAYER) this->HandleEditBox(NGWW_PLAYER); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
497 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
498 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
499 |
virtual void OnInvalidateData(int data) |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
500 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
501 |
if (data != 0) this->server = NULL; |
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
502 |
this->servers.ForceRebuild(); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
503 |
this->SetDirty(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
504 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
505 |
|
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10596
diff
changeset
|
506 |
virtual EventState OnKeyPress(uint16 key, uint16 keycode) |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
507 |
{ |
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10596
diff
changeset
|
508 |
EventState state = ES_NOT_HANDLED; |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
509 |
if (this->field != NGWW_PLAYER) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
510 |
if (this->server != NULL) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
511 |
if (keycode == WKC_DELETE) { // Press 'delete' to remove servers |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
512 |
NetworkGameListRemoveItem(this->server); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
513 |
NetworkRebuildHostList(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
514 |
this->server = NULL; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
515 |
} |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
516 |
} |
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10596
diff
changeset
|
517 |
return state; |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
518 |
} |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
519 |
|
10780
1c73c1821c44
(svn r13330) -Fix: 'Player name' dialog was broken in two ways
smatz
parents:
10778
diff
changeset
|
520 |
if (this->HandleEditBoxKey(NGWW_PLAYER, key, keycode, state) == 1) return state; // enter pressed |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
521 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
522 |
/* The name is only allowed when it starts with a letter! */ |
10780
1c73c1821c44
(svn r13330) -Fix: 'Player name' dialog was broken in two ways
smatz
parents:
10778
diff
changeset
|
523 |
if (!StrEmpty(this->edit_str_buf) && this->edit_str_buf[0] != ' ') { |
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
524 |
ttd_strlcpy(_settings_client.network.player_name, this->edit_str_buf, lengthof(_settings_client.network.player_name)); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
525 |
} else { |
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
526 |
ttd_strlcpy(_settings_client.network.player_name, "Player", lengthof(_settings_client.network.player_name)); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
527 |
} |
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10596
diff
changeset
|
528 |
return state; |
0 | 529 |
} |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
530 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
531 |
virtual void OnQueryTextFinished(char *str) |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
532 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
533 |
if (!StrEmpty(str)) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
534 |
NetworkAddServer(str); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
535 |
NetworkRebuildHostList(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
536 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
537 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
538 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
539 |
virtual void OnResize(Point new_size, Point delta) |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
540 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
541 |
this->vscroll.cap += delta.y / (int)this->resize.step_height; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
542 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
543 |
this->widget[NGWW_MATRIX].data = (this->vscroll.cap << 8) + 1; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
544 |
|
10716
2406d1520245
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
10703
diff
changeset
|
545 |
SetVScrollCount(this, this->servers.Length()); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
546 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
547 |
int widget_width = this->widget[NGWW_FIND].right - this->widget[NGWW_FIND].left; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
548 |
int space = (this->width - 4 * widget_width - 25) / 3; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
549 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
550 |
int offset = 10; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
551 |
for (uint i = 0; i < 4; i++) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
552 |
this->widget[NGWW_FIND + i].left = offset; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
553 |
offset += widget_width; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
554 |
this->widget[NGWW_FIND + i].right = offset; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
555 |
offset += space; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
556 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
557 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
558 |
}; |
0 | 559 |
|
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
560 |
Listing NetworkGameWindow::last_sorting = {false, 2}; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
561 |
GUIGameServerList::SortFunction *const NetworkGameWindow::sorter_funcs[] = { |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
562 |
&NGameNameSorter, |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
563 |
&NGameClientSorter, |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
564 |
&NGameAllowedSorter |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
565 |
}; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
566 |
|
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
567 |
|
0 | 568 |
static const Widget _network_game_window_widgets[] = { |
8456
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
569 |
/* TOP */ |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
570 |
{ WWT_CLOSEBOX, RESIZE_NONE, BGC, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // NGWW_CLOSE |
10170
39c950e2ab9d
(svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents:
9234
diff
changeset
|
571 |
{ WWT_CAPTION, RESIZE_RIGHT, BGC, 11, 449, 0, 13, STR_NETWORK_MULTIPLAYER, STR_NULL}, // NGWW_CAPTION |
39c950e2ab9d
(svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents:
9234
diff
changeset
|
572 |
{ WWT_PANEL, RESIZE_RB, BGC, 0, 449, 14, 263, 0x0, STR_NULL}, // NGWW_RESIZE |
0 | 573 |
|
10170
39c950e2ab9d
(svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents:
9234
diff
changeset
|
574 |
{ WWT_TEXT, RESIZE_NONE, BGC, 9, 85, 23, 35, STR_NETWORK_CONNECTION, STR_NULL}, // NGWW_CONNECTION |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
575 |
{ WWT_DROPDOWNIN, RESIZE_NONE, BGC, 90, 181, 22, 33, STR_NETWORK_LAN_INTERNET_COMBO, STR_NETWORK_CONNECTION_TIP}, // NGWW_CONN_BTN |
2881
1ffbbdbf1685
(svn r3429) - Feature (Followup): Change the gamelist window to accomodate for the new information.
Darkvater
parents:
2879
diff
changeset
|
576 |
|
9233
4daa9bb8dbf7
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
9224
diff
changeset
|
577 |
{ WWT_EDITBOX, RESIZE_LR, BGC, 290, 440, 22, 33, STR_NETWORK_PLAYER_NAME_OSKTITLE, STR_NETWORK_ENTER_NAME_TIP}, // NGWW_PLAYER |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
578 |
|
8456
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
579 |
/* LEFT SIDE */ |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
580 |
{ WWT_PUSHTXTBTN, RESIZE_RIGHT, BTC, 10, 70, 42, 53, STR_NETWORK_GAME_NAME, STR_NETWORK_GAME_NAME_TIP}, // NGWW_NAME |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
581 |
{ WWT_PUSHTXTBTN, RESIZE_LR, BTC, 71, 150, 42, 53, STR_NETWORK_CLIENTS_CAPTION, STR_NETWORK_CLIENTS_CAPTION_TIP}, // NGWW_CLIENTS |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
582 |
{ WWT_PUSHTXTBTN, RESIZE_LR, BTC, 151, 190, 42, 53, STR_EMPTY, STR_NETWORK_INFO_ICONS_TIP}, // NGWW_INFO |
7935
b5bc2bd79e6b
(svn r10886) -Codechange: modify the "start network server" GUI so it can actually handle more than 10 clients/companies/spectators in a nice way, i.e. without making a combobox with 100 players and add 90 new strings to be able to do so.
rubidium
parents:
7859
diff
changeset
|
583 |
|
10178
8fde48e0ddac
(svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium
parents:
10170
diff
changeset
|
584 |
{ WWT_MATRIX, RESIZE_RB, BGC, 10, 190, 54, 208, (11 << 8) + 1, STR_NETWORK_CLICK_GAME_TO_SELECT}, // NGWW_MATRIX |
8fde48e0ddac
(svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium
parents:
10170
diff
changeset
|
585 |
{ WWT_SCROLLBAR, RESIZE_LRB, BGC, 191, 202, 42, 208, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, // NGWW_SCROLLBAR |
8fde48e0ddac
(svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium
parents:
10170
diff
changeset
|
586 |
{ WWT_TEXT, RESIZE_RTB, BGC, 10, 190, 211, 222, STR_NETWORK_LAST_JOINED_SERVER, STR_NULL}, // NGWW_LASTJOINED_LABEL |
8fde48e0ddac
(svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium
parents:
10170
diff
changeset
|
587 |
{ WWT_PANEL, RESIZE_RTB, BGC, 10, 190, 223, 236, 0x0, STR_NETWORK_CLICK_TO_SELECT_LAST}, // NGWW_LASTJOINED |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
588 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
589 |
/* RIGHT SIDE */ |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
590 |
{ WWT_PANEL, RESIZE_LRB, BGC, 210, 440, 42, 236, 0x0, STR_NULL}, // NGWW_DETAILS |
2881
1ffbbdbf1685
(svn r3429) - Feature (Followup): Change the gamelist window to accomodate for the new information.
Darkvater
parents:
2879
diff
changeset
|
591 |
|
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
592 |
{ WWT_PUSHTXTBTN, RESIZE_LRTB, BTC, 215, 315, 215, 226, STR_NETWORK_JOIN_GAME, STR_NULL}, // NGWW_JOIN |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
593 |
{ WWT_PUSHTXTBTN, RESIZE_LRTB, BTC, 330, 435, 215, 226, STR_NETWORK_REFRESH, STR_NETWORK_REFRESH_TIP}, // NGWW_REFRESH |
5339
7573f179efe8
(svn r7505) -Feature: show NewGRFs used on a game server, show which NewGRFs you do and do not have.
rubidium
parents:
5247
diff
changeset
|
594 |
|
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
595 |
{ WWT_PUSHTXTBTN, RESIZE_LRTB, BTC, 330, 435, 197, 208, STR_NEWGRF_SETTINGS_BUTTON, STR_NULL}, // NGWW_NEWGRF |
7839
5c43edaa9de0
(svn r10706) -Codechange: allow resizing the multiplayer server list window.
rubidium
parents:
7837
diff
changeset
|
596 |
|
8456
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
597 |
/* BOTTOM */ |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
598 |
{ WWT_PUSHTXTBTN, RESIZE_TB, BTC, 10, 110, 246, 257, STR_NETWORK_FIND_SERVER, STR_NETWORK_FIND_SERVER_TIP}, // NGWW_FIND |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
599 |
{ WWT_PUSHTXTBTN, RESIZE_TB, BTC, 118, 218, 246, 257, STR_NETWORK_ADD_SERVER, STR_NETWORK_ADD_SERVER_TIP}, // NGWW_ADD |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
600 |
{ WWT_PUSHTXTBTN, RESIZE_TB, BTC, 226, 326, 246, 257, STR_NETWORK_START_SERVER, STR_NETWORK_START_SERVER_TIP}, // NGWW_START |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
601 |
{ WWT_PUSHTXTBTN, RESIZE_TB, BTC, 334, 434, 246, 257, STR_012E_CANCEL, STR_NULL}, // NGWW_CANCEL |
7935
b5bc2bd79e6b
(svn r10886) -Codechange: modify the "start network server" GUI so it can actually handle more than 10 clients/companies/spectators in a nice way, i.e. without making a combobox with 100 players and add 90 new strings to be able to do so.
rubidium
parents:
7859
diff
changeset
|
602 |
|
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
603 |
{ WWT_RESIZEBOX, RESIZE_LRTB, BGC, 438, 449, 252, 263, 0x0, STR_RESIZE_BUTTON }, |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
604 |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
175
diff
changeset
|
605 |
{ WIDGETS_END}, |
0 | 606 |
}; |
607 |
||
608 |
static const WindowDesc _network_game_window_desc = { |
|
7839
5c43edaa9de0
(svn r10706) -Codechange: allow resizing the multiplayer server list window.
rubidium
parents:
7837
diff
changeset
|
609 |
WDP_CENTER, WDP_CENTER, 450, 264, 550, 264, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5920
diff
changeset
|
610 |
WC_NETWORK_WINDOW, WC_NONE, |
7839
5c43edaa9de0
(svn r10706) -Codechange: allow resizing the multiplayer server list window.
rubidium
parents:
7837
diff
changeset
|
611 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE, |
0 | 612 |
_network_game_window_widgets, |
613 |
}; |
|
614 |
||
6573 | 615 |
void ShowNetworkGameWindow() |
0 | 616 |
{ |
2922
61cf61d25de9
(svn r3478) - Fix: In the network game list do the default sorting on connectivity (so servers which you can join are on top) and sort on names as a second criteria on clients and connectivity.
Darkvater
parents:
2914
diff
changeset
|
617 |
static bool first = true; |
0 | 618 |
DeleteWindowById(WC_NETWORK_WINDOW, 0); |
105 | 619 |
|
764
68b398e2b780
(svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents:
749
diff
changeset
|
620 |
/* Only show once */ |
2922
61cf61d25de9
(svn r3478) - Fix: In the network game list do the default sorting on connectivity (so servers which you can join are on top) and sort on names as a second criteria on clients and connectivity.
Darkvater
parents:
2914
diff
changeset
|
621 |
if (first) { |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
622 |
char * const *srv; |
2881
1ffbbdbf1685
(svn r3429) - Feature (Followup): Change the gamelist window to accomodate for the new information.
Darkvater
parents:
2879
diff
changeset
|
623 |
|
2922
61cf61d25de9
(svn r3478) - Fix: In the network game list do the default sorting on connectivity (so servers which you can join are on top) and sort on names as a second criteria on clients and connectivity.
Darkvater
parents:
2914
diff
changeset
|
624 |
first = false; |
764
68b398e2b780
(svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents:
749
diff
changeset
|
625 |
// add all servers from the config file to our list |
2885
c06f2f3985a0
(svn r3435) - Fix a warning, removed unused extern and some comments in network_gamelist.c
Darkvater
parents:
2884
diff
changeset
|
626 |
for (srv = &_network_host_list[0]; srv != endof(_network_host_list) && *srv != NULL; srv++) { |
2881
1ffbbdbf1685
(svn r3429) - Feature (Followup): Change the gamelist window to accomodate for the new information.
Darkvater
parents:
2879
diff
changeset
|
627 |
NetworkAddServer(*srv); |
764
68b398e2b780
(svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents:
749
diff
changeset
|
628 |
} |
68b398e2b780
(svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents:
749
diff
changeset
|
629 |
} |
68b398e2b780
(svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents:
749
diff
changeset
|
630 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
631 |
new NetworkGameWindow(&_network_game_window_desc); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
632 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
633 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
634 |
enum { |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
635 |
NSSWND_START = 64, |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
636 |
NSSWND_ROWSIZE = 12 |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
637 |
}; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
638 |
|
8455
218ce4bc9b23
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents:
8427
diff
changeset
|
639 |
/** Enum for NetworkStartServerWindow, referring to _network_start_server_window_widgets */ |
218ce4bc9b23
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents:
8427
diff
changeset
|
640 |
enum NetworkStartServerWidgets { |
218ce4bc9b23
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents:
8427
diff
changeset
|
641 |
NSSW_CLOSE = 0, ///< Close 'X' button |
218ce4bc9b23
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents:
8427
diff
changeset
|
642 |
NSSW_GAMENAME = 4, ///< Background for editbox to set game name |
218ce4bc9b23
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents:
8427
diff
changeset
|
643 |
NSSW_SETPWD = 5, ///< 'Set password' button |
218ce4bc9b23
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents:
8427
diff
changeset
|
644 |
NSSW_SELMAP = 7, ///< 'Select map' list |
8839
bd8a5bb77cd7
(svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents:
8780
diff
changeset
|
645 |
NSSW_CONNTYPE_BTN = 10, ///< 'Connection type' droplist button |
bd8a5bb77cd7
(svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents:
8780
diff
changeset
|
646 |
NSSW_CLIENTS_BTND = 12, ///< 'Max clients' downarrow |
bd8a5bb77cd7
(svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents:
8780
diff
changeset
|
647 |
NSSW_CLIENTS_TXT = 13, ///< 'Max clients' text |
bd8a5bb77cd7
(svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents:
8780
diff
changeset
|
648 |
NSSW_CLIENTS_BTNU = 14, ///< 'Max clients' uparrow |
bd8a5bb77cd7
(svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents:
8780
diff
changeset
|
649 |
NSSW_COMPANIES_BTND = 16, ///< 'Max companies' downarrow |
bd8a5bb77cd7
(svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents:
8780
diff
changeset
|
650 |
NSSW_COMPANIES_TXT = 17, ///< 'Max companies' text |
bd8a5bb77cd7
(svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents:
8780
diff
changeset
|
651 |
NSSW_COMPANIES_BTNU = 18, ///< 'Max companies' uparrow |
bd8a5bb77cd7
(svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents:
8780
diff
changeset
|
652 |
NSSW_SPECTATORS_BTND = 20, ///< 'Max spectators' downarrow |
bd8a5bb77cd7
(svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents:
8780
diff
changeset
|
653 |
NSSW_SPECTATORS_TXT = 21, ///< 'Max spectators' text |
bd8a5bb77cd7
(svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents:
8780
diff
changeset
|
654 |
NSSW_SPECTATORS_BTNU = 22, ///< 'Max spectators' uparrow |
bd8a5bb77cd7
(svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents:
8780
diff
changeset
|
655 |
NSSW_LANGUAGE_BTN = 24, ///< 'Language spoken' droplist button |
bd8a5bb77cd7
(svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents:
8780
diff
changeset
|
656 |
NSSW_START = 25, ///< 'Start' button |
bd8a5bb77cd7
(svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents:
8780
diff
changeset
|
657 |
NSSW_LOAD = 26, ///< 'Load' button |
bd8a5bb77cd7
(svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents:
8780
diff
changeset
|
658 |
NSSW_CANCEL = 27, ///< 'Cancel' button |
8455
218ce4bc9b23
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents:
8427
diff
changeset
|
659 |
}; |
218ce4bc9b23
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents:
8427
diff
changeset
|
660 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
661 |
struct NetworkStartServerWindow : public QueryStringBaseWindow { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
662 |
byte field; ///< Selected text-field |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
663 |
FiosItem *map; ///< Selected map |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
664 |
byte widget_id; ///< The widget that has the pop-up input menu |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
665 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
666 |
NetworkStartServerWindow(const WindowDesc *desc) : QueryStringBaseWindow(desc) |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
667 |
{ |
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
668 |
ttd_strlcpy(this->edit_str_buf, _settings_client.network.server_name, lengthof(this->edit_str_buf)); |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
669 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
670 |
_saveload_mode = SLD_NEW_GAME; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
671 |
BuildFileList(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
672 |
this->vscroll.cap = 12; |
10808
d42b140d24f2
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
10792
diff
changeset
|
673 |
this->vscroll.count = _fios_items.Length(); |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
674 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
675 |
this->afilter = CS_ALPHANUMERAL; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
676 |
InitializeTextBuffer(&this->text, this->edit_str_buf, lengthof(this->edit_str_buf), 160); |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
677 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
678 |
this->field = NSSW_GAMENAME; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
679 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
680 |
this->FindWindowPlacementAndResize(desc); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
681 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
682 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
683 |
virtual void OnPaint() |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
684 |
{ |
10808
d42b140d24f2
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
10792
diff
changeset
|
685 |
int y = NSSWND_START; |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
686 |
const FiosItem *item; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
687 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
688 |
/* draw basic widgets */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
689 |
SetDParam(1, _connection_types_dropdown[_network_advertise]); |
10818
95a5bba4e812
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents:
10808
diff
changeset
|
690 |
SetDParam(2, _settings_client.network.max_clients); |
95a5bba4e812
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents:
10808
diff
changeset
|
691 |
SetDParam(3, _settings_client.network.max_companies); |
95a5bba4e812
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents:
10808
diff
changeset
|
692 |
SetDParam(4, _settings_client.network.max_spectators); |
95a5bba4e812
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents:
10808
diff
changeset
|
693 |
SetDParam(5, STR_NETWORK_LANG_ANY + _settings_client.network.server_lang); |
10595
7957c71b0dfe
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
10591
diff
changeset
|
694 |
this->DrawWidgets(); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
695 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
696 |
/* editbox to set game name */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
697 |
this->DrawEditBox(NSSW_GAMENAME); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
698 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
699 |
/* if password is set, draw red '*' next to 'Set password' button */ |
10818
95a5bba4e812
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents:
10808
diff
changeset
|
700 |
if (!StrEmpty(_settings_client.network.server_password)) DoDrawString("*", 408, 23, TC_RED); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
701 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
702 |
/* draw list of maps */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
703 |
GfxFillRect(11, 63, 258, 215, 0xD7); // black background of maps list |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
704 |
|
10808
d42b140d24f2
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
10792
diff
changeset
|
705 |
for (uint pos = this->vscroll.pos; pos < _fios_items.Length() + 1; pos++) { |
d42b140d24f2
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
10792
diff
changeset
|
706 |
item = _fios_items.Get(pos - 1); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
707 |
if (item == this->map || (pos == 0 && this->map == NULL)) |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
708 |
GfxFillRect(11, y - 1, 258, y + 10, 155); // show highlighted item with a different colour |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
709 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
710 |
if (pos == 0) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
711 |
DrawString(14, y, STR_4010_GENERATE_RANDOM_NEW_GAME, TC_DARK_GREEN); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
712 |
} else { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
713 |
DoDrawString(item->title, 14, y, _fios_colors[item->type] ); |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
714 |
} |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
715 |
y += NSSWND_ROWSIZE; |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
716 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
717 |
if (y >= this->vscroll.cap * NSSWND_ROWSIZE + NSSWND_START) break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
718 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
719 |
} |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
720 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
721 |
virtual void OnClick(Point pt, int widget) |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
722 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
723 |
if (widget != NSSW_CONNTYPE_BTN && widget != NSSW_LANGUAGE_BTN) HideDropDownMenu(this); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
724 |
this->field = widget; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
725 |
switch (widget) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
726 |
case NSSW_CLOSE: // Close 'X' |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
727 |
case NSSW_CANCEL: // Cancel button |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
728 |
ShowNetworkGameWindow(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
729 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
730 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
731 |
case NSSW_GAMENAME: |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
732 |
ShowOnScreenKeyboard(this, NSSW_GAMENAME, 0, 0); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
733 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
734 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
735 |
case NSSW_SETPWD: // Set password button |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
736 |
this->widget_id = NSSW_SETPWD; |
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
737 |
ShowQueryString(BindCString(_settings_client.network.server_password), STR_NETWORK_SET_PASSWORD, 20, 250, this, CS_ALPHANUMERAL); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
738 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
739 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
740 |
case NSSW_SELMAP: { // Select map |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
741 |
int y = (pt.y - NSSWND_START) / NSSWND_ROWSIZE; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
742 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
743 |
y += this->vscroll.pos; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
744 |
if (y >= this->vscroll.count) return; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
745 |
|
10808
d42b140d24f2
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
10792
diff
changeset
|
746 |
this->map = (y == 0) ? NULL : _fios_items.Get(y - 1); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
747 |
this->SetDirty(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
748 |
} break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
749 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
750 |
case NSSW_CONNTYPE_BTN: // Connection type |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
751 |
ShowDropDownMenu(this, _connection_types_dropdown, _network_advertise, NSSW_CONNTYPE_BTN, 0, 0); // do it for widget NSSW_CONNTYPE_BTN |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
752 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
753 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
754 |
case NSSW_CLIENTS_BTND: case NSSW_CLIENTS_BTNU: // Click on up/down button for number of clients |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
755 |
case NSSW_COMPANIES_BTND: case NSSW_COMPANIES_BTNU: // Click on up/down button for number of companies |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
756 |
case NSSW_SPECTATORS_BTND: case NSSW_SPECTATORS_BTNU: // Click on up/down button for number of spectators |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
757 |
/* Don't allow too fast scrolling */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
758 |
if ((this->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
759 |
this->HandleButtonClick(widget); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
760 |
this->SetDirty(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
761 |
switch (widget) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
762 |
default: NOT_REACHED(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
763 |
case NSSW_CLIENTS_BTND: case NSSW_CLIENTS_BTNU: |
10818
95a5bba4e812
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents:
10808
diff
changeset
|
764 |
_settings_client.network.max_clients = Clamp(_settings_client.network.max_clients + widget - NSSW_CLIENTS_TXT, 2, MAX_CLIENTS); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
765 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
766 |
case NSSW_COMPANIES_BTND: case NSSW_COMPANIES_BTNU: |
10818
95a5bba4e812
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents:
10808
diff
changeset
|
767 |
_settings_client.network.max_companies = Clamp(_settings_client.network.max_companies + widget - NSSW_COMPANIES_TXT, 1, MAX_PLAYERS); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
768 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
769 |
case NSSW_SPECTATORS_BTND: case NSSW_SPECTATORS_BTNU: |
10818
95a5bba4e812
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents:
10808
diff
changeset
|
770 |
_settings_client.network.max_spectators = Clamp(_settings_client.network.max_spectators + widget - NSSW_SPECTATORS_TXT, 0, MAX_CLIENTS); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
771 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
772 |
} |
7935
b5bc2bd79e6b
(svn r10886) -Codechange: modify the "start network server" GUI so it can actually handle more than 10 clients/companies/spectators in a nice way, i.e. without making a combobox with 100 players and add 90 new strings to be able to do so.
rubidium
parents:
7859
diff
changeset
|
773 |
} |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
774 |
_left_button_clicked = false; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
775 |
break; |
2887
d5967e472eee
(svn r3439) - CodeChange: Remove a whole bunch of global variables and put them into the WP() macro. Also combine more than one WP-custom element. For this the maximum size of w->custom (WP) has been increased, and multiple types put inside one with possibly moved to the corresponding gui file if it is only used there.
Darkvater
parents:
2886
diff
changeset
|
776 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
777 |
case NSSW_CLIENTS_TXT: // Click on number of players |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
778 |
this->widget_id = NSSW_CLIENTS_TXT; |
10818
95a5bba4e812
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents:
10808
diff
changeset
|
779 |
SetDParam(0, _settings_client.network.max_clients); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
780 |
ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_NETWORK_NUMBER_OF_CLIENTS, 3, 50, this, CS_NUMERAL); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
781 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
782 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
783 |
case NSSW_COMPANIES_TXT: // Click on number of companies |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
784 |
this->widget_id = NSSW_COMPANIES_TXT; |
10818
95a5bba4e812
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents:
10808
diff
changeset
|
785 |
SetDParam(0, _settings_client.network.max_companies); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
786 |
ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_NETWORK_NUMBER_OF_COMPANIES, 3, 50, this, CS_NUMERAL); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
787 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
788 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
789 |
case NSSW_SPECTATORS_TXT: // Click on number of spectators |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
790 |
this->widget_id = NSSW_SPECTATORS_TXT; |
10818
95a5bba4e812
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents:
10808
diff
changeset
|
791 |
SetDParam(0, _settings_client.network.max_spectators); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
792 |
ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_NETWORK_NUMBER_OF_SPECTATORS, 3, 50, this, CS_NUMERAL); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
793 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
794 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
795 |
case NSSW_LANGUAGE_BTN: { // Language |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
796 |
uint sel = 0; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
797 |
for (uint i = 0; i < lengthof(_language_dropdown) - 1; i++) { |
10818
95a5bba4e812
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents:
10808
diff
changeset
|
798 |
if (_language_dropdown[i] == STR_NETWORK_LANG_ANY + _settings_client.network.server_lang) { |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
799 |
sel = i; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
800 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
801 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
802 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
803 |
ShowDropDownMenu(this, _language_dropdown, sel, NSSW_LANGUAGE_BTN, 0, 0); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
804 |
} break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
805 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
806 |
case NSSW_START: // Start game |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
807 |
_is_network_server = true; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
808 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
809 |
if (this->map == NULL) { // start random new game |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
810 |
ShowGenerateLandscape(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
811 |
} else { // load a scenario |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
812 |
char *name = FiosBrowseTo(this->map); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
813 |
if (name != NULL) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
814 |
SetFiosType(this->map->type); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
815 |
_file_to_saveload.filetype = FT_SCENARIO; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
816 |
ttd_strlcpy(_file_to_saveload.name, name, sizeof(_file_to_saveload.name)); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
817 |
ttd_strlcpy(_file_to_saveload.title, this->map->title, sizeof(_file_to_saveload.title)); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
818 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
819 |
delete this; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
820 |
SwitchMode(SM_START_SCENARIO); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
821 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
822 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
823 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
824 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
825 |
case NSSW_LOAD: // Load game |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
826 |
_is_network_server = true; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
827 |
/* XXX - WC_NETWORK_WINDOW (this window) should stay, but if it stays, it gets |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
828 |
* copied all the elements of 'load game' and upon closing that, it segfaults */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
829 |
delete this; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
830 |
ShowSaveLoadDialog(SLD_LOAD_GAME); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
831 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
832 |
} |
0 | 833 |
} |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
834 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
835 |
virtual void OnDropdownSelect(int widget, int index) |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
836 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
837 |
switch (widget) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
838 |
case NSSW_CONNTYPE_BTN: |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
839 |
_network_advertise = (index != 0); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
840 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
841 |
case NSSW_LANGUAGE_BTN: |
10818
95a5bba4e812
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents:
10808
diff
changeset
|
842 |
_settings_client.network.server_lang = _language_dropdown[index] - STR_NETWORK_LANG_ANY; |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
843 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
844 |
default: |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
845 |
NOT_REACHED(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
846 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
847 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
848 |
this->SetDirty(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
849 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
850 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
851 |
virtual void OnMouseLoop() |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
852 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
853 |
if (this->field == NSSW_GAMENAME) this->HandleEditBox(NSSW_GAMENAME); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
854 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
855 |
|
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10596
diff
changeset
|
856 |
virtual EventState OnKeyPress(uint16 key, uint16 keycode) |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
857 |
{ |
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10596
diff
changeset
|
858 |
EventState state = ES_NOT_HANDLED; |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
859 |
if (this->field == NSSW_GAMENAME) { |
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10596
diff
changeset
|
860 |
if (this->HandleEditBoxKey(NSSW_GAMENAME, key, keycode, state) == 1) return state; // enter pressed |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
861 |
|
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
862 |
ttd_strlcpy(_settings_client.network.server_name, this->text.buf, sizeof(_settings_client.network.server_name)); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
863 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
864 |
|
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10596
diff
changeset
|
865 |
return state; |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
866 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
867 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
868 |
virtual void OnQueryTextFinished(char *str) |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
869 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
870 |
if (str == NULL) return; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
871 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
872 |
if (this->widget_id == NSSW_SETPWD) { |
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
873 |
ttd_strlcpy(_settings_client.network.server_password, str, lengthof(_settings_client.network.server_password)); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
874 |
} else { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
875 |
int32 value = atoi(str); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
876 |
this->InvalidateWidget(this->widget_id); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
877 |
switch (this->widget_id) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
878 |
default: NOT_REACHED(); |
10818
95a5bba4e812
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents:
10808
diff
changeset
|
879 |
case NSSW_CLIENTS_TXT: _settings_client.network.max_clients = Clamp(value, 2, MAX_CLIENTS); break; |
95a5bba4e812
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents:
10808
diff
changeset
|
880 |
case NSSW_COMPANIES_TXT: _settings_client.network.max_companies = Clamp(value, 1, MAX_PLAYERS); break; |
95a5bba4e812
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents:
10808
diff
changeset
|
881 |
case NSSW_SPECTATORS_TXT: _settings_client.network.max_spectators = Clamp(value, 0, MAX_CLIENTS); break; |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
882 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
883 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
884 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
885 |
this->SetDirty(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
886 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
887 |
}; |
0 | 888 |
|
889 |
static const Widget _network_start_server_window_widgets[] = { |
|
8455
218ce4bc9b23
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents:
8427
diff
changeset
|
890 |
/* Window decoration and background panel */ |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
891 |
{ WWT_CLOSEBOX, RESIZE_NONE, BGC, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW }, // NSSW_CLOSE |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
892 |
{ WWT_CAPTION, RESIZE_NONE, BGC, 11, 419, 0, 13, STR_NETWORK_START_GAME_WINDOW, STR_NULL}, |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
893 |
{ WWT_PANEL, RESIZE_NONE, BGC, 0, 419, 14, 243, 0x0, STR_NULL}, |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
853
diff
changeset
|
894 |
|
8455
218ce4bc9b23
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents:
8427
diff
changeset
|
895 |
/* Set game name and password widgets */ |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
896 |
{ WWT_TEXT, RESIZE_NONE, BGC, 10, 90, 22, 34, STR_NETWORK_NEW_GAME_NAME, STR_NULL}, |
9233
4daa9bb8dbf7
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
9224
diff
changeset
|
897 |
{ WWT_EDITBOX, RESIZE_NONE, BGC, 100, 272, 22, 33, STR_NETWORK_NEW_GAME_NAME_OSKTITLE, STR_NETWORK_NEW_GAME_NAME_TIP}, // NSSW_GAMENAME |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
898 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, BTC, 285, 405, 22, 33, STR_NETWORK_SET_PASSWORD, STR_NETWORK_PASSWORD_TIP}, // NSSW_SETPWD |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
853
diff
changeset
|
899 |
|
8455
218ce4bc9b23
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents:
8427
diff
changeset
|
900 |
/* List of playable scenarios */ |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
901 |
{ WWT_TEXT, RESIZE_NONE, BGC, 10, 110, 43, 55, STR_NETWORK_SELECT_MAP, STR_NULL}, |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
902 |
{ WWT_INSET, RESIZE_NONE, BGC, 10, 271, 62, 216, STR_NULL, STR_NETWORK_SELECT_MAP_TIP}, // NSSW_SELMAP |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
903 |
{ WWT_SCROLLBAR, RESIZE_NONE, BGC, 259, 270, 63, 215, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
8455
218ce4bc9b23
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents:
8427
diff
changeset
|
904 |
|
7935
b5bc2bd79e6b
(svn r10886) -Codechange: modify the "start network server" GUI so it can actually handle more than 10 clients/companies/spectators in a nice way, i.e. without making a combobox with 100 players and add 90 new strings to be able to do so.
rubidium
parents:
7859
diff
changeset
|
905 |
/* Combo/selection boxes to control Connection Type / Max Clients / Max Companies / Max Observers / Language */ |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
906 |
{ WWT_TEXT, RESIZE_NONE, BGC, 280, 419, 63, 75, STR_NETWORK_CONNECTION, STR_NULL}, |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
907 |
{ WWT_DROPDOWNIN, RESIZE_NONE, BGC, 280, 410, 77, 88, STR_NETWORK_LAN_INTERNET_COMBO, STR_NETWORK_CONNECTION_TIP}, // NSSW_CONNTYPE_BTN |
7935
b5bc2bd79e6b
(svn r10886) -Codechange: modify the "start network server" GUI so it can actually handle more than 10 clients/companies/spectators in a nice way, i.e. without making a combobox with 100 players and add 90 new strings to be able to do so.
rubidium
parents:
7859
diff
changeset
|
908 |
|
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
909 |
{ WWT_TEXT, RESIZE_NONE, BGC, 280, 419, 95, 107, STR_NETWORK_NUMBER_OF_CLIENTS, STR_NULL}, |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
910 |
{ WWT_IMGBTN, RESIZE_NONE, BGC, 280, 291, 109, 120, SPR_ARROW_DOWN, STR_NETWORK_NUMBER_OF_CLIENTS_TIP}, // NSSW_CLIENTS_BTND |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
911 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, BGC, 292, 397, 109, 120, STR_NETWORK_CLIENTS_SELECT, STR_NETWORK_NUMBER_OF_CLIENTS_TIP}, // NSSW_CLIENTS_TXT |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
912 |
{ WWT_IMGBTN, RESIZE_NONE, BGC, 398, 410, 109, 120, SPR_ARROW_UP, STR_NETWORK_NUMBER_OF_CLIENTS_TIP}, // NSSW_CLIENTS_BTNU |
8455
218ce4bc9b23
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents:
8427
diff
changeset
|
913 |
|
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
914 |
{ WWT_TEXT, RESIZE_NONE, BGC, 280, 419, 127, 139, STR_NETWORK_NUMBER_OF_COMPANIES, STR_NULL}, |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
915 |
{ WWT_IMGBTN, RESIZE_NONE, BGC, 280, 291, 141, 152, SPR_ARROW_DOWN, STR_NETWORK_NUMBER_OF_COMPANIES_TIP}, // NSSW_COMPANIES_BTND |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
916 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, BGC, 292, 397, 141, 152, STR_NETWORK_COMPANIES_SELECT, STR_NETWORK_NUMBER_OF_COMPANIES_TIP}, // NSSW_COMPANIES_TXT |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
917 |
{ WWT_IMGBTN, RESIZE_NONE, BGC, 398, 410, 141, 152, SPR_ARROW_UP, STR_NETWORK_NUMBER_OF_COMPANIES_TIP}, // NSSW_COMPANIES_BTNU |
8455
218ce4bc9b23
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents:
8427
diff
changeset
|
918 |
|
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
919 |
{ WWT_TEXT, RESIZE_NONE, BGC, 280, 419, 159, 171, STR_NETWORK_NUMBER_OF_SPECTATORS, STR_NULL}, |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
920 |
{ WWT_IMGBTN, RESIZE_NONE, BGC, 280, 291, 173, 184, SPR_ARROW_DOWN, STR_NETWORK_NUMBER_OF_SPECTATORS_TIP}, // NSSW_SPECTATORS_BTND |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
921 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, BGC, 292, 397, 173, 184, STR_NETWORK_SPECTATORS_SELECT, STR_NETWORK_NUMBER_OF_SPECTATORS_TIP}, // NSSW_SPECTATORS_TXT |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
922 |
{ WWT_IMGBTN, RESIZE_NONE, BGC, 398, 410, 173, 184, SPR_ARROW_UP, STR_NETWORK_NUMBER_OF_SPECTATORS_TIP}, // NSSW_SPECTATORS_BTNU |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
923 |
|
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
924 |
{ WWT_TEXT, RESIZE_NONE, BGC, 280, 419, 191, 203, STR_NETWORK_LANGUAGE_SPOKEN, STR_NULL}, |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
925 |
{ WWT_DROPDOWNIN, RESIZE_NONE, BGC, 280, 410, 205, 216, STR_NETWORK_LANGUAGE_COMBO, STR_NETWORK_LANGUAGE_TIP}, // NSSW_LANGUAGE_BTN |
8455
218ce4bc9b23
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents:
8427
diff
changeset
|
926 |
|
218ce4bc9b23
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents:
8427
diff
changeset
|
927 |
/* Buttons Start / Load / Cancel */ |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
928 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, BTC, 40, 140, 224, 235, STR_NETWORK_START_GAME, STR_NETWORK_START_GAME_TIP}, // NSSW_START |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
929 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, BTC, 150, 250, 224, 235, STR_NETWORK_LOAD_GAME, STR_NETWORK_LOAD_GAME_TIP}, // NSSW_LOAD |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
930 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, BTC, 260, 360, 224, 235, STR_012E_CANCEL, STR_NULL}, // NSSW_CANCEL |
8455
218ce4bc9b23
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents:
8427
diff
changeset
|
931 |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
175
diff
changeset
|
932 |
{ WIDGETS_END}, |
0 | 933 |
}; |
934 |
||
935 |
static const WindowDesc _network_start_server_window_desc = { |
|
7837
65d7362153a6
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7817
diff
changeset
|
936 |
WDP_CENTER, WDP_CENTER, 420, 244, 420, 244, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5920
diff
changeset
|
937 |
WC_NETWORK_WINDOW, WC_NONE, |
2064
c889fcc76398
(svn r2573) Codechange: Removed WDF_RESTORE_DPARAM, it's not needed with the new string system.
ludde
parents:
2055
diff
changeset
|
938 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
0 | 939 |
_network_start_server_window_widgets, |
940 |
}; |
|
941 |
||
6573 | 942 |
static void ShowNetworkStartServerWindow() |
0 | 943 |
{ |
944 |
DeleteWindowById(WC_NETWORK_WINDOW, 0); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
945 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
946 |
new NetworkStartServerWindow(&_network_start_server_window_desc); |
0 | 947 |
} |
948 |
||
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
949 |
static PlayerID NetworkLobbyFindCompanyIndex(byte pos) |
734
018e549265ed
(svn r1186) -Fix: [Network] You can now join a company on a server where a company
truelight
parents:
722
diff
changeset
|
950 |
{ |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
951 |
/* Scroll through all _network_player_info and get the 'pos' item that is not empty */ |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
952 |
for (PlayerID i = PLAYER_FIRST; i < MAX_PLAYERS; i++) { |
734
018e549265ed
(svn r1186) -Fix: [Network] You can now join a company on a server where a company
truelight
parents:
722
diff
changeset
|
953 |
if (_network_player_info[i].company_name[0] != '\0') { |
2639 | 954 |
if (pos-- == 0) return i; |
734
018e549265ed
(svn r1186) -Fix: [Network] You can now join a company on a server where a company
truelight
parents:
722
diff
changeset
|
955 |
} |
018e549265ed
(svn r1186) -Fix: [Network] You can now join a company on a server where a company
truelight
parents:
722
diff
changeset
|
956 |
} |
018e549265ed
(svn r1186) -Fix: [Network] You can now join a company on a server where a company
truelight
parents:
722
diff
changeset
|
957 |
|
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
958 |
return PLAYER_FIRST; |
734
018e549265ed
(svn r1186) -Fix: [Network] You can now join a company on a server where a company
truelight
parents:
722
diff
changeset
|
959 |
} |
018e549265ed
(svn r1186) -Fix: [Network] You can now join a company on a server where a company
truelight
parents:
722
diff
changeset
|
960 |
|
8459
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
961 |
/** Enum for NetworkLobbyWindow, referring to _network_lobby_window_widgets */ |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
962 |
enum NetworkLobbyWindowWidgets { |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
963 |
NLWW_CLOSE = 0, ///< Close 'X' button |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
964 |
NLWW_MATRIX = 5, ///< List of companies |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
965 |
NLWW_DETAILS = 7, ///< Company details |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
966 |
NLWW_JOIN = 8, ///< 'Join company' button |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
967 |
NLWW_NEW = 9, ///< 'New company' button |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
968 |
NLWW_SPECTATE = 10, ///< 'Spectate game' button |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
969 |
NLWW_REFRESH = 11, ///< 'Refresh server' button |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
970 |
NLWW_CANCEL = 12, ///< 'Cancel' button |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
971 |
}; |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
972 |
|
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
973 |
struct NetworkLobbyWindow : public Window { |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
974 |
PlayerID company; ///< Select company |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
975 |
NetworkGameList *server; ///< Selected server |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
976 |
|
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
977 |
NetworkLobbyWindow(const WindowDesc *desc, NetworkGameList *ngl) : |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
978 |
Window(desc), company(INVALID_PLAYER), server(ngl) |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
979 |
{ |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
980 |
this->vscroll.cap = 10; |
10498
f198d0a1aab7
(svn r13041) -Fix: calling a virtual function on a not fully constructed object is bound to cause errors.
rubidium
parents:
10497
diff
changeset
|
981 |
|
f198d0a1aab7
(svn r13041) -Fix: calling a virtual function on a not fully constructed object is bound to cause errors.
rubidium
parents:
10497
diff
changeset
|
982 |
this->FindWindowPlacementAndResize(desc); |
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
983 |
} |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
984 |
|
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
985 |
virtual void OnPaint() |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
986 |
{ |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
987 |
const NetworkGameInfo *gi = &this->server->info; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
988 |
int y = NET_PRC__OFFSET_TOP_WIDGET_COMPANY, pos; |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
989 |
|
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
990 |
/* Join button is disabled when no company is selected */ |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
991 |
this->SetWidgetDisabledState(NLWW_JOIN, this->company == INVALID_PLAYER); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
992 |
/* Cannot start new company if there are too many */ |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
993 |
this->SetWidgetDisabledState(NLWW_NEW, gi->companies_on >= gi->companies_max); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
994 |
/* Cannot spectate if there are too many spectators */ |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
995 |
this->SetWidgetDisabledState(NLWW_SPECTATE, gi->spectators_on >= gi->spectators_max); |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
996 |
|
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
997 |
/* Draw window widgets */ |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
998 |
SetDParamStr(0, gi->server_name); |
10595
7957c71b0dfe
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
10591
diff
changeset
|
999 |
this->DrawWidgets(); |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1000 |
|
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1001 |
/* Draw company list */ |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1002 |
pos = this->vscroll.pos; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1003 |
while (pos < gi->companies_on) { |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1004 |
byte company = NetworkLobbyFindCompanyIndex(pos); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1005 |
bool income = false; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1006 |
if (this->company == company) { |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1007 |
GfxFillRect(11, y - 1, 154, y + 10, 10); // show highlighted item with a different colour |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1008 |
} |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1009 |
|
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1010 |
DoDrawStringTruncated(_network_player_info[company].company_name, 13, y, TC_BLACK, 135 - 13); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1011 |
if (_network_player_info[company].use_password != 0) DrawSprite(SPR_LOCK, PAL_NONE, 135, y); |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1012 |
|
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1013 |
/* If the company's income was positive puts a green dot else a red dot */ |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1014 |
if (_network_player_info[company].income >= 0) income = true; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1015 |
DrawSprite(SPR_BLOT, income ? PALETTE_TO_GREEN : PALETTE_TO_RED, 145, y); |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1016 |
|
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1017 |
pos++; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1018 |
y += NET_PRC__SIZE_OF_ROW; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1019 |
if (pos >= this->vscroll.cap) break; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1020 |
} |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1021 |
|
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1022 |
/* Draw info about selected company when it is selected in the left window */ |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1023 |
GfxFillRect(174, 39, 403, 75, 157); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1024 |
DrawStringCentered(290, 50, STR_NETWORK_COMPANY_INFO, TC_FROMSTRING); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1025 |
if (this->company != INVALID_PLAYER) { |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1026 |
const uint x = 183; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1027 |
const uint trunc_width = this->widget[NLWW_DETAILS].right - x; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1028 |
y = 80; |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1029 |
|
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1030 |
SetDParam(0, gi->clients_on); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1031 |
SetDParam(1, gi->clients_max); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1032 |
SetDParam(2, gi->companies_on); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1033 |
SetDParam(3, gi->companies_max); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1034 |
DrawString(x, y, STR_NETWORK_CLIENTS, TC_GOLD); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1035 |
y += 10; |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1036 |
|
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1037 |
SetDParamStr(0, _network_player_info[this->company].company_name); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1038 |
DrawStringTruncated(x, y, STR_NETWORK_COMPANY_NAME, TC_GOLD, trunc_width); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1039 |
y += 10; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1040 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1041 |
SetDParam(0, _network_player_info[this->company].inaugurated_year); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1042 |
DrawString(x, y, STR_NETWORK_INAUGURATION_YEAR, TC_GOLD); // inauguration year |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1043 |
y += 10; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1044 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1045 |
SetDParam(0, _network_player_info[this->company].company_value); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1046 |
DrawString(x, y, STR_NETWORK_VALUE, TC_GOLD); // company value |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1047 |
y += 10; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1048 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1049 |
SetDParam(0, _network_player_info[this->company].money); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1050 |
DrawString(x, y, STR_NETWORK_CURRENT_BALANCE, TC_GOLD); // current balance |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1051 |
y += 10; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1052 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1053 |
SetDParam(0, _network_player_info[this->company].income); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1054 |
DrawString(x, y, STR_NETWORK_LAST_YEARS_INCOME, TC_GOLD); // last year's income |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1055 |
y += 10; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1056 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1057 |
SetDParam(0, _network_player_info[this->company].performance); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1058 |
DrawString(x, y, STR_NETWORK_PERFORMANCE, TC_GOLD); // performance |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1059 |
y += 10; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1060 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1061 |
SetDParam(0, _network_player_info[this->company].num_vehicle[0]); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1062 |
SetDParam(1, _network_player_info[this->company].num_vehicle[1]); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1063 |
SetDParam(2, _network_player_info[this->company].num_vehicle[2]); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1064 |
SetDParam(3, _network_player_info[this->company].num_vehicle[3]); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1065 |
SetDParam(4, _network_player_info[this->company].num_vehicle[4]); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1066 |
DrawString(x, y, STR_NETWORK_VEHICLES, TC_GOLD); // vehicles |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1067 |
y += 10; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1068 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1069 |
SetDParam(0, _network_player_info[this->company].num_station[0]); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1070 |
SetDParam(1, _network_player_info[this->company].num_station[1]); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1071 |
SetDParam(2, _network_player_info[this->company].num_station[2]); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1072 |
SetDParam(3, _network_player_info[this->company].num_station[3]); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1073 |
SetDParam(4, _network_player_info[this->company].num_station[4]); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1074 |
DrawString(x, y, STR_NETWORK_STATIONS, TC_GOLD); // stations |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1075 |
y += 10; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1076 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1077 |
SetDParamStr(0, _network_player_info[this->company].players); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1078 |
DrawStringTruncated(x, y, STR_NETWORK_PLAYERS, TC_GOLD, trunc_width); // players |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1079 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1080 |
} |
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1081 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1082 |
virtual void OnClick(Point pt, int widget) |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1083 |
{ |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1084 |
switch (widget) { |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1085 |
case NLWW_CLOSE: // Close 'X' |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1086 |
case NLWW_CANCEL: // Cancel button |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1087 |
ShowNetworkGameWindow(); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1088 |
break; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1089 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1090 |
case NLWW_MATRIX: { // Company list |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1091 |
uint32 id_v = (pt.y - NET_PRC__OFFSET_TOP_WIDGET_COMPANY) / NET_PRC__SIZE_OF_ROW; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1092 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1093 |
if (id_v >= this->vscroll.cap) break; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1094 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1095 |
id_v += this->vscroll.pos; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1096 |
this->company = (id_v >= this->server->info.companies_on) ? INVALID_PLAYER : NetworkLobbyFindCompanyIndex(id_v); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1097 |
this->SetDirty(); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1098 |
} break; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1099 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1100 |
case NLWW_JOIN: // Join company |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1101 |
/* Button can be clicked only when it is enabled */ |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1102 |
_network_playas = this->company; |
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
1103 |
NetworkClientConnectGame(_settings_client.network.last_host, _settings_client.network.last_port); |
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1104 |
break; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1105 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1106 |
case NLWW_NEW: // New company |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1107 |
_network_playas = PLAYER_NEW_COMPANY; |
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
1108 |
NetworkClientConnectGame(_settings_client.network.last_host, _settings_client.network.last_port); |
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1109 |
break; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1110 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1111 |
case NLWW_SPECTATE: // Spectate game |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1112 |
_network_playas = PLAYER_SPECTATOR; |
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
1113 |
NetworkClientConnectGame(_settings_client.network.last_host, _settings_client.network.last_port); |
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1114 |
break; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1115 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1116 |
case NLWW_REFRESH: // Refresh |
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
1117 |
NetworkTCPQueryServer(_settings_client.network.last_host, _settings_client.network.last_port); // company info |
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
1118 |
NetworkUDPQueryServer(_settings_client.network.last_host, _settings_client.network.last_port); // general data |
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1119 |
break; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1120 |
} |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1121 |
} |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1122 |
}; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1123 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1124 |
static const Widget _network_lobby_window_widgets[] = { |
8459
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
1125 |
{ WWT_CLOSEBOX, RESIZE_NONE, BGC, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW }, // NLWW_CLOSE |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
1126 |
{ WWT_CAPTION, RESIZE_NONE, BGC, 11, 419, 0, 13, STR_NETWORK_GAME_LOBBY, STR_NULL}, |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
1127 |
{ WWT_PANEL, RESIZE_NONE, BGC, 0, 419, 14, 234, 0x0, STR_NULL}, |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
1128 |
{ WWT_TEXT, RESIZE_NONE, BGC, 10, 419, 22, 34, STR_NETWORK_PREPARE_TO_JOIN, STR_NULL}, |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1129 |
|
8459
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
1130 |
/* company list */ |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
1131 |
{ WWT_PANEL, RESIZE_NONE, BTC, 10, 155, 38, 49, 0x0, STR_NULL}, |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
1132 |
{ WWT_MATRIX, RESIZE_NONE, BGC, 10, 155, 50, 190, (10 << 8) + 1, STR_NETWORK_COMPANY_LIST_TIP}, // NLWW_MATRIX |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
1133 |
{ WWT_SCROLLBAR, RESIZE_NONE, BGC, 156, 167, 38, 190, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1134 |
|
8459
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
1135 |
/* company/player info */ |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
1136 |
{ WWT_PANEL, RESIZE_NONE, BGC, 173, 404, 38, 190, 0x0, STR_NULL}, // NLWW_DETAILS |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
1137 |
|
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
1138 |
/* buttons */ |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
1139 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, BTC, 10, 151, 200, 211, STR_NETWORK_JOIN_COMPANY, STR_NETWORK_JOIN_COMPANY_TIP}, // NLWW_JOIN |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
1140 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, BTC, 10, 151, 215, 226, STR_NETWORK_NEW_COMPANY, STR_NETWORK_NEW_COMPANY_TIP}, // NLWW_NEW |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
1141 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, BTC, 158, 268, 200, 211, STR_NETWORK_SPECTATE_GAME, STR_NETWORK_SPECTATE_GAME_TIP}, // NLWW_SPECTATE |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
1142 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, BTC, 158, 268, 215, 226, STR_NETWORK_REFRESH, STR_NETWORK_REFRESH_TIP}, // NLWW_REFRESH |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
1143 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, BTC, 278, 388, 200, 211, STR_012E_CANCEL, STR_NULL}, // NLWW_CANCEL |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1144 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1145 |
{ WIDGETS_END}, |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1146 |
}; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1147 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1148 |
static const WindowDesc _network_lobby_window_desc = { |
7837
65d7362153a6
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7817
diff
changeset
|
1149 |
WDP_CENTER, WDP_CENTER, 420, 235, 420, 235, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5920
diff
changeset
|
1150 |
WC_NETWORK_WINDOW, WC_NONE, |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1151 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1152 |
_network_lobby_window_widgets, |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1153 |
}; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1154 |
|
2888
0972346d11a8
(svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents:
2887
diff
changeset
|
1155 |
/* Show the networklobbywindow with the selected server |
0972346d11a8
(svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents:
2887
diff
changeset
|
1156 |
* @param ngl Selected game pointer which is passed to the new window */ |
2887
d5967e472eee
(svn r3439) - CodeChange: Remove a whole bunch of global variables and put them into the WP() macro. Also combine more than one WP-custom element. For this the maximum size of w->custom (WP) has been increased, and multiple types put inside one with possibly moved to the corresponding gui file if it is only used there.
Darkvater
parents:
2886
diff
changeset
|
1157 |
static void ShowNetworkLobbyWindow(NetworkGameList *ngl) |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1158 |
{ |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1159 |
DeleteWindowById(WC_NETWORK_WINDOW, 0); |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1160 |
|
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
1161 |
NetworkTCPQueryServer(_settings_client.network.last_host, _settings_client.network.last_port); // company info |
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
1162 |
NetworkUDPQueryServer(_settings_client.network.last_host, _settings_client.network.last_port); // general data |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1163 |
|
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1164 |
new NetworkLobbyWindow(&_network_lobby_window_desc, ngl); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1165 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1166 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1167 |
// The window below gives information about the connected clients |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1168 |
// and also makes able to give money to them, kick them (if server) |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1169 |
// and stuff like that. |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1170 |
|
3692 | 1171 |
extern void DrawPlayerIcon(PlayerID pid, int x, int y); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1172 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1173 |
// Every action must be of this form |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1174 |
typedef void ClientList_Action_Proc(byte client_no); |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1175 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1176 |
// Max 10 actions per client |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1177 |
#define MAX_CLIENTLIST_ACTION 10 |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1178 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1179 |
enum { |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1180 |
CLNWND_OFFSET = 16, |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1181 |
CLNWND_ROWSIZE = 10 |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1182 |
}; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1183 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
853
diff
changeset
|
1184 |
static const Widget _client_list_widgets[] = { |
2725
5c632bc5be28
(svn r3270) Correct all (mis)uses of WWT_CLOSEBOX / WWT_TEXTBTN to reflect their actual use, and add "Close Window" tooltip where missing.
peter1138
parents:
2669
diff
changeset
|
1185 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
7525
d0e21b315b60
(svn r10293) -Add [FS#885]: a sticky button for the client list window (oxygene)
truelight
parents:
7498
diff
changeset
|
1186 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 237, 0, 13, STR_NETWORK_CLIENT_LIST, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
d0e21b315b60
(svn r10293) -Add [FS#885]: a sticky button for the client list window (oxygene)
truelight
parents:
7498
diff
changeset
|
1187 |
{ WWT_STICKYBOX, RESIZE_NONE, 14, 238, 249, 0, 13, STR_NULL, STR_STICKY_BUTTON}, |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1188 |
|
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1189 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 249, 14, 14 + CLNWND_ROWSIZE + 1, 0x0, STR_NULL}, |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1190 |
{ WIDGETS_END}, |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1191 |
}; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1192 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
853
diff
changeset
|
1193 |
static const Widget _client_list_popup_widgets[] = { |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
1194 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 99, 0, 0, 0, STR_NULL}, |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1195 |
{ WIDGETS_END}, |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1196 |
}; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1197 |
|
10641
13148f508e6d
(svn r13185) -Codechange: remove everything related to the WindowProc callbacks.
rubidium
parents:
10625
diff
changeset
|
1198 |
static const WindowDesc _client_list_desc = { |
7837
65d7362153a6
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7817
diff
changeset
|
1199 |
WDP_AUTO, WDP_AUTO, 250, 1, 250, 1, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5920
diff
changeset
|
1200 |
WC_CLIENT_LIST, WC_NONE, |
7525
d0e21b315b60
(svn r10293) -Add [FS#885]: a sticky button for the client list window (oxygene)
truelight
parents:
7498
diff
changeset
|
1201 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1202 |
_client_list_widgets, |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1203 |
}; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1204 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1205 |
// Finds the Xth client-info that is active |
4171 | 1206 |
static const NetworkClientInfo *NetworkFindClientInfo(byte client_no) |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1207 |
{ |
4171 | 1208 |
const NetworkClientInfo *ci; |
2630 | 1209 |
|
4883
801b93ae218c
(svn r6820) -Codechange: Some more const correctness, coding style.
Darkvater
parents:
4880
diff
changeset
|
1210 |
FOR_ALL_ACTIVE_CLIENT_INFOS(ci) { |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1211 |
if (client_no == 0) return ci; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1212 |
client_no--; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1213 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1214 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1215 |
return NULL; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1216 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1217 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1218 |
// Here we start to define the options out of the menu |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1219 |
static void ClientList_Kick(byte client_no) |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1220 |
{ |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1221 |
if (client_no < MAX_PLAYERS) |
4880
0708f34e3586
(svn r6816) -Codechange: Some coding style, variable localization, const correctness.
Darkvater
parents:
4878
diff
changeset
|
1222 |
SEND_COMMAND(PACKET_SERVER_ERROR)(DEREF_CLIENT(client_no), NETWORK_ERROR_KICKED); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1223 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1224 |
|
841
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
827
diff
changeset
|
1225 |
static void ClientList_Ban(byte client_no) |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1226 |
{ |
841
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
827
diff
changeset
|
1227 |
uint32 ip = NetworkFindClientInfo(client_no)->client_ip; |
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
827
diff
changeset
|
1228 |
|
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1229 |
for (uint i = 0; i < lengthof(_network_ban_list); i++) { |
2914
04ce2485f05f
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2889
diff
changeset
|
1230 |
if (_network_ban_list[i] == NULL) { |
841
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
827
diff
changeset
|
1231 |
_network_ban_list[i] = strdup(inet_ntoa(*(struct in_addr *)&ip)); |
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
827
diff
changeset
|
1232 |
break; |
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
827
diff
changeset
|
1233 |
} |
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
827
diff
changeset
|
1234 |
} |
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
827
diff
changeset
|
1235 |
|
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1236 |
if (client_no < MAX_PLAYERS) { |
4880
0708f34e3586
(svn r6816) -Codechange: Some coding style, variable localization, const correctness.
Darkvater
parents:
4878
diff
changeset
|
1237 |
SEND_COMMAND(PACKET_SERVER_ERROR)(DEREF_CLIENT(client_no), NETWORK_ERROR_KICKED); |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1238 |
} |
841
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
827
diff
changeset
|
1239 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1240 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1241 |
static void ClientList_GiveMoney(byte client_no) |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1242 |
{ |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1243 |
if (NetworkFindClientInfo(client_no) != NULL) { |
4878
744717de172e
(svn r6814) -Codechange: For network games ci->client_playas was always p->index + 1. To
Darkvater
parents:
4861
diff
changeset
|
1244 |
ShowNetworkGiveMoneyWindow(NetworkFindClientInfo(client_no)->client_playas); |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1245 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1246 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1247 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1248 |
static void ClientList_SpeakToClient(byte client_no) |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1249 |
{ |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1250 |
if (NetworkFindClientInfo(client_no) != NULL) { |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1251 |
ShowNetworkChatQueryWindow(DESTTYPE_CLIENT, NetworkFindClientInfo(client_no)->client_index); |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1252 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1253 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1254 |
|
4906
8a10678a62a3
(svn r6876) -Codechange: Change the naming of _PLAYER in DESTTYPE_PLAYER/NETWORK_ACTION_CHAT_PLAYER
Darkvater
parents:
4895
diff
changeset
|
1255 |
static void ClientList_SpeakToCompany(byte client_no) |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1256 |
{ |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1257 |
if (NetworkFindClientInfo(client_no) != NULL) { |
4906
8a10678a62a3
(svn r6876) -Codechange: Change the naming of _PLAYER in DESTTYPE_PLAYER/NETWORK_ACTION_CHAT_PLAYER
Darkvater
parents:
4895
diff
changeset
|
1258 |
ShowNetworkChatQueryWindow(DESTTYPE_TEAM, NetworkFindClientInfo(client_no)->client_playas); |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1259 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1260 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1261 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1262 |
static void ClientList_SpeakToAll(byte client_no) |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1263 |
{ |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1264 |
ShowNetworkChatQueryWindow(DESTTYPE_BROADCAST, 0); |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1265 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1266 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1267 |
static void ClientList_None(byte client_no) |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1268 |
{ |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1269 |
/* No action ;) */ |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1270 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1271 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1272 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1273 |
|
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1274 |
struct NetworkClientListPopupWindow : Window { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1275 |
int sel_index; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1276 |
int client_no; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1277 |
char action[MAX_CLIENTLIST_ACTION][50]; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1278 |
ClientList_Action_Proc *proc[MAX_CLIENTLIST_ACTION]; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1279 |
|
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1280 |
NetworkClientListPopupWindow(int x, int y, const Widget *widgets, int client_no) : |
10625
3c1f6a26db71
(svn r13169) -Codechange: remove a (now) unneeded parameter of one of the Window constructors.
rubidium
parents:
10607
diff
changeset
|
1281 |
Window(x, y, 150, 100, WC_TOOLBAR_MENU, widgets), |
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1282 |
sel_index(0), client_no(client_no) |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1283 |
{ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1284 |
/* |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1285 |
* Fill the actions this client has. |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1286 |
* Watch is, max 50 chars long! |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1287 |
*/ |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1288 |
|
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1289 |
const NetworkClientInfo *ci = NetworkFindClientInfo(client_no); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1290 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1291 |
int i = 0; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1292 |
if (_network_own_client_index != ci->client_index) { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1293 |
GetString(this->action[i], STR_NETWORK_CLIENTLIST_SPEAK_TO_CLIENT, lastof(this->action[i])); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1294 |
this->proc[i++] = &ClientList_SpeakToClient; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1295 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1296 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1297 |
if (IsValidPlayer(ci->client_playas) || ci->client_playas == PLAYER_SPECTATOR) { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1298 |
GetString(this->action[i], STR_NETWORK_CLIENTLIST_SPEAK_TO_COMPANY, lastof(this->action[i])); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1299 |
this->proc[i++] = &ClientList_SpeakToCompany; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1300 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1301 |
GetString(this->action[i], STR_NETWORK_CLIENTLIST_SPEAK_TO_ALL, lastof(this->action[i])); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1302 |
this->proc[i++] = &ClientList_SpeakToAll; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1303 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1304 |
if (_network_own_client_index != ci->client_index) { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1305 |
/* We are no spectator and the player we want to give money to is no spectator and money gifts are allowed */ |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10741
diff
changeset
|
1306 |
if (IsValidPlayer(_network_playas) && IsValidPlayer(ci->client_playas) && _settings_game.economy.give_money) { |
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1307 |
GetString(this->action[i], STR_NETWORK_CLIENTLIST_GIVE_MONEY, lastof(this->action[i])); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1308 |
this->proc[i++] = &ClientList_GiveMoney; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1309 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1310 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1311 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1312 |
/* A server can kick clients (but not himself) */ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1313 |
if (_network_server && _network_own_client_index != ci->client_index) { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1314 |
GetString(this->action[i], STR_NETWORK_CLIENTLIST_KICK, lastof(this->action[i])); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1315 |
this->proc[i++] = &ClientList_Kick; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1316 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1317 |
sprintf(this->action[i],"Ban"); // XXX GetString? |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1318 |
this->proc[i++] = &ClientList_Ban; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1319 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1320 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1321 |
if (i == 0) { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1322 |
GetString(this->action[i], STR_NETWORK_CLIENTLIST_NONE, lastof(this->action[i])); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1323 |
this->proc[i++] = &ClientList_None; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1324 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1325 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1326 |
/* Calculate the height */ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1327 |
int h = ClientListPopupHeight(); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1328 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1329 |
/* Allocate the popup */ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1330 |
this->widget[0].bottom = this->widget[0].top + h; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1331 |
this->widget[0].right = this->widget[0].left + 150; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1332 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1333 |
this->flags4 &= ~WF_WHITE_BORDER_MASK; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1334 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1335 |
this->FindWindowPlacementAndResize(150, h + 1); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1336 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1337 |
|
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1338 |
/** |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1339 |
* An action is clicked! What do we do? |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1340 |
*/ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1341 |
void HandleClientListPopupClick(byte index) |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1342 |
{ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1343 |
/* A click on the Popup of the ClientList.. handle the command */ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1344 |
if (index < MAX_CLIENTLIST_ACTION && this->proc[index] != NULL) { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1345 |
this->proc[index](this->client_no); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1346 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1347 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1348 |
|
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1349 |
/** |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1350 |
* Finds the amount of actions in the popup and set the height correct |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1351 |
*/ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1352 |
uint ClientListPopupHeight() |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1353 |
{ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1354 |
int num = 0; |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
853
diff
changeset
|
1355 |
|
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1356 |
// Find the amount of actions |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1357 |
for (int i = 0; i < MAX_CLIENTLIST_ACTION; i++) { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1358 |
if (this->action[i][0] == '\0') continue; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1359 |
if (this->proc[i] == NULL) continue; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1360 |
num++; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1361 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1362 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1363 |
num *= CLNWND_ROWSIZE; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1364 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1365 |
return num + 1; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1366 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1367 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1368 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1369 |
virtual void OnPaint() |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1370 |
{ |
10595
7957c71b0dfe
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
10591
diff
changeset
|
1371 |
this->DrawWidgets(); |
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1372 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1373 |
/* Draw the actions */ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1374 |
int sel = this->sel_index; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1375 |
int y = 1; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1376 |
for (int i = 0; i < MAX_CLIENTLIST_ACTION; i++, y += CLNWND_ROWSIZE) { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1377 |
if (this->action[i][0] == '\0') continue; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1378 |
if (this->proc[i] == NULL) continue; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1379 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1380 |
TextColour colour; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1381 |
if (sel-- == 0) { // Selected item, highlight it |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1382 |
GfxFillRect(1, y, 150 - 2, y + CLNWND_ROWSIZE - 1, 0); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1383 |
colour = TC_WHITE; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1384 |
} else { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1385 |
colour = TC_BLACK; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1386 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1387 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1388 |
DoDrawString(this->action[i], 4, y, colour); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1389 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1390 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1391 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1392 |
virtual void OnMouseLoop() |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1393 |
{ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1394 |
/* We selected an action */ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1395 |
int index = (_cursor.pos.y - this->top) / CLNWND_ROWSIZE; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1396 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1397 |
if (_left_button_down) { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1398 |
if (index == -1 || index == this->sel_index) return; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1399 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1400 |
this->sel_index = index; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1401 |
this->SetDirty(); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1402 |
} else { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1403 |
if (index >= 0 && _cursor.pos.y >= this->top) { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1404 |
HandleClientListPopupClick(index); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1405 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1406 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1407 |
DeleteWindowById(WC_TOOLBAR_MENU, 0); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1408 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1409 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1410 |
}; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1411 |
|
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1412 |
/** |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1413 |
* Show the popup (action list) |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1414 |
*/ |
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1415 |
static void PopupClientList(int client_no, int x, int y) |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1416 |
{ |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1417 |
DeleteWindowById(WC_TOOLBAR_MENU, 0); |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1418 |
|
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1419 |
if (NetworkFindClientInfo(client_no) == NULL) return; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1420 |
|
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1421 |
new NetworkClientListPopupWindow(x, y, _client_list_popup_widgets, client_no); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1422 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1423 |
|
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1424 |
/** |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1425 |
* Main handle for clientlist |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1426 |
*/ |
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1427 |
struct NetworkClientListWindow : Window |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1428 |
{ |
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1429 |
byte selected_item; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1430 |
byte selected_y; |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1431 |
|
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1432 |
NetworkClientListWindow(const WindowDesc *desc, WindowNumber window_number) : |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1433 |
Window(desc, window_number), |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1434 |
selected_item(0), |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1435 |
selected_y(255) |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1436 |
{ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1437 |
this->FindWindowPlacementAndResize(desc); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1438 |
} |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1439 |
|
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1440 |
/** |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1441 |
* Finds the amount of clients and set the height correct |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1442 |
*/ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1443 |
bool CheckClientListHeight() |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1444 |
{ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1445 |
int num = 0; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1446 |
const NetworkClientInfo *ci; |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1447 |
|
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1448 |
/* Should be replaced with a loop through all clients */ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1449 |
FOR_ALL_ACTIVE_CLIENT_INFOS(ci) { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1450 |
num++; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1451 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1452 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1453 |
num *= CLNWND_ROWSIZE; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1454 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1455 |
/* If height is changed */ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1456 |
if (this->height != CLNWND_OFFSET + num + 1) { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1457 |
// XXX - magic unfortunately; (num + 2) has to be one bigger than heigh (num + 1) |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1458 |
this->SetDirty(); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1459 |
this->widget[3].bottom = this->widget[3].top + num + 2; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1460 |
this->height = CLNWND_OFFSET + num + 1; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1461 |
this->SetDirty(); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1462 |
return false; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1463 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1464 |
return true; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1465 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1466 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1467 |
virtual void OnPaint() |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1468 |
{ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1469 |
NetworkClientInfo *ci; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1470 |
int i = 0; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1471 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1472 |
/* Check if we need to reset the height */ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1473 |
if (!this->CheckClientListHeight()) return; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1474 |
|
10595
7957c71b0dfe
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
10591
diff
changeset
|
1475 |
this->DrawWidgets(); |
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1476 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1477 |
int y = CLNWND_OFFSET; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1478 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1479 |
FOR_ALL_ACTIVE_CLIENT_INFOS(ci) { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1480 |
TextColour colour; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1481 |
if (this->selected_item == i++) { // Selected item, highlight it |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1482 |
GfxFillRect(1, y, 248, y + CLNWND_ROWSIZE - 1, 0); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1483 |
colour = TC_WHITE; |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4013
diff
changeset
|
1484 |
} else { |
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1485 |
colour = TC_BLACK; |
2639 | 1486 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1487 |
|
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1488 |
if (ci->client_index == NETWORK_SERVER_INDEX) { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1489 |
DrawString(4, y, STR_NETWORK_SERVER, colour); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1490 |
} else { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1491 |
DrawString(4, y, STR_NETWORK_CLIENT, colour); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1492 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1493 |
|
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1494 |
/* Filter out spectators */ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1495 |
if (IsValidPlayer(ci->client_playas)) DrawPlayerIcon(ci->client_playas, 64, y + 1); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1496 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1497 |
DoDrawString(ci->client_name, 81, y, colour); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1498 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1499 |
y += CLNWND_ROWSIZE; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1500 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1501 |
} |
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1502 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1503 |
virtual void OnClick(Point pt, int widget) |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1504 |
{ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1505 |
/* Show the popup with option */ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1506 |
if (this->selected_item != 255) { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1507 |
PopupClientList(this->selected_item, pt.x + this->left, pt.y + this->top); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1508 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1509 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1510 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1511 |
virtual void OnMouseOver(Point pt, int widget) |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1512 |
{ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1513 |
/* -1 means we left the current window */ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1514 |
if (pt.y == -1) { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1515 |
this->selected_y = 0; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1516 |
this->selected_item = 255; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1517 |
this->SetDirty(); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1518 |
return; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1519 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1520 |
/* It did not change.. no update! */ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1521 |
if (pt.y == this->selected_y) return; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1522 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1523 |
/* Find the new selected item (if any) */ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1524 |
this->selected_y = pt.y; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1525 |
if (pt.y > CLNWND_OFFSET) { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1526 |
this->selected_item = (pt.y - CLNWND_OFFSET) / CLNWND_ROWSIZE; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1527 |
} else { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1528 |
this->selected_item = 255; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1529 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1530 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1531 |
/* Repaint */ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1532 |
this->SetDirty(); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1533 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1534 |
}; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1535 |
|
6573 | 1536 |
void ShowClientList() |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1537 |
{ |
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1538 |
AllocateWindowDescFront<NetworkClientListWindow>(&_client_list_desc, 0); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1539 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1540 |
|
4512
7151d4ee3a0f
(svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents:
4491
diff
changeset
|
1541 |
|
7151d4ee3a0f
(svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents:
4491
diff
changeset
|
1542 |
static NetworkPasswordType pw_type; |
7151d4ee3a0f
(svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents:
4491
diff
changeset
|
1543 |
|
7151d4ee3a0f
(svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents:
4491
diff
changeset
|
1544 |
|
7151d4ee3a0f
(svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents:
4491
diff
changeset
|
1545 |
void ShowNetworkNeedPassword(NetworkPasswordType npt) |
7151d4ee3a0f
(svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents:
4491
diff
changeset
|
1546 |
{ |
7151d4ee3a0f
(svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents:
4491
diff
changeset
|
1547 |
StringID caption; |
7151d4ee3a0f
(svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents:
4491
diff
changeset
|
1548 |
|
7151d4ee3a0f
(svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents:
4491
diff
changeset
|
1549 |
pw_type = npt; |
7151d4ee3a0f
(svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents:
4491
diff
changeset
|
1550 |
switch (npt) { |
7151d4ee3a0f
(svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents:
4491
diff
changeset
|
1551 |
default: NOT_REACHED(); |
4774
91b96d852ba5
(svn r6688) -Fix (r6297): Wrong caption for server password query window (eg put 'break' after switch statements)
Darkvater
parents:
4719
diff
changeset
|
1552 |
case NETWORK_GAME_PASSWORD: caption = STR_NETWORK_NEED_GAME_PASSWORD_CAPTION; break; |
91b96d852ba5
(svn r6688) -Fix (r6297): Wrong caption for server password query window (eg put 'break' after switch statements)
Darkvater
parents:
4719
diff
changeset
|
1553 |
case NETWORK_COMPANY_PASSWORD: caption = STR_NETWORK_NEED_COMPANY_PASSWORD_CAPTION; break; |
4512
7151d4ee3a0f
(svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents:
4491
diff
changeset
|
1554 |
} |
5682
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5352
diff
changeset
|
1555 |
ShowQueryString(STR_EMPTY, caption, 20, 180, FindWindowById(WC_NETWORK_STATUS_WINDOW, 0), CS_ALPHANUMERAL); |
4512
7151d4ee3a0f
(svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents:
4491
diff
changeset
|
1556 |
} |
7151d4ee3a0f
(svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents:
4491
diff
changeset
|
1557 |
|
10792
95b6eb9fcc9e
(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:
10784
diff
changeset
|
1558 |
// Vars needed for the join-GUI |
95b6eb9fcc9e
(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:
10784
diff
changeset
|
1559 |
NetworkJoinStatus _network_join_status; |
95b6eb9fcc9e
(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:
10784
diff
changeset
|
1560 |
uint8 _network_join_waiting; |
95b6eb9fcc9e
(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:
10784
diff
changeset
|
1561 |
uint16 _network_join_kbytes; |
95b6eb9fcc9e
(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:
10784
diff
changeset
|
1562 |
uint16 _network_join_kbytes_total; |
95b6eb9fcc9e
(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:
10784
diff
changeset
|
1563 |
|
10591
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1564 |
struct NetworkJoinStatusWindow : Window { |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1565 |
NetworkJoinStatusWindow(const WindowDesc *desc) : Window(desc) |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1566 |
{ |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1567 |
this->parent = FindWindowById(WC_NETWORK_WINDOW, 0); |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1568 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1569 |
|
10591
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1570 |
virtual void OnPaint() |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1571 |
{ |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1572 |
uint8 progress; // used for progress bar |
10595
7957c71b0dfe
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
10591
diff
changeset
|
1573 |
this->DrawWidgets(); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1574 |
|
10591
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1575 |
DrawStringCentered(125, 35, STR_NETWORK_CONNECTING_1 + _network_join_status, TC_GREY); |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1576 |
switch (_network_join_status) { |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1577 |
case NETWORK_JOIN_STATUS_CONNECTING: case NETWORK_JOIN_STATUS_AUTHORIZING: |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1578 |
case NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO: |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1579 |
progress = 10; // first two stages 10% |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1580 |
break; |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1581 |
case NETWORK_JOIN_STATUS_WAITING: |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1582 |
SetDParam(0, _network_join_waiting); |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1583 |
DrawStringCentered(125, 46, STR_NETWORK_CONNECTING_WAITING, TC_GREY); |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1584 |
progress = 15; // third stage is 15% |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1585 |
break; |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1586 |
case NETWORK_JOIN_STATUS_DOWNLOADING: |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1587 |
SetDParam(0, _network_join_kbytes); |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1588 |
SetDParam(1, _network_join_kbytes_total); |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1589 |
DrawStringCentered(125, 46, STR_NETWORK_CONNECTING_DOWNLOADING, TC_GREY); |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1590 |
/* Fallthrough */ |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1591 |
default: /* Waiting is 15%, so the resting receivement of map is maximum 70% */ |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1592 |
progress = 15 + _network_join_kbytes * (100 - 15) / _network_join_kbytes_total; |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1593 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1594 |
|
10591
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1595 |
/* Draw nice progress bar :) */ |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1596 |
DrawFrameRect(20, 18, (int)((this->width - 20) * progress / 100), 28, 10, FR_NONE); |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1597 |
} |
4512
7151d4ee3a0f
(svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents:
4491
diff
changeset
|
1598 |
|
10591
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1599 |
virtual void OnClick(Point pt, int widget) |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1600 |
{ |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1601 |
if (widget == 2) { //Disconnect button |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1602 |
NetworkDisconnect(); |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1603 |
SwitchMode(SM_MENU); |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1604 |
ShowNetworkGameWindow(); |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1605 |
} |
0 | 1606 |
} |
10591
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1607 |
|
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1608 |
virtual void OnQueryTextFinished(char *str) |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1609 |
{ |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1610 |
if (StrEmpty(str)) { |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1611 |
NetworkDisconnect(); |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1612 |
ShowNetworkGameWindow(); |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1613 |
} else { |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1614 |
SEND_COMMAND(PACKET_CLIENT_PASSWORD)(pw_type, str); |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1615 |
} |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1616 |
} |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1617 |
}; |
0 | 1618 |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1619 |
static const Widget _network_join_status_window_widget[] = { |
5683
dca046ba7aa3
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5682
diff
changeset
|
1620 |
{ WWT_CAPTION, RESIZE_NONE, 14, 0, 249, 0, 13, STR_NETWORK_CONNECTING, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1621 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 249, 14, 84, 0x0, STR_NULL}, |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
853
diff
changeset
|
1622 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, BTC, 75, 175, 69, 80, STR_NETWORK_DISCONNECT, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
175
diff
changeset
|
1623 |
{ WIDGETS_END}, |
0 | 1624 |
}; |
1625 |
||
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1626 |
static const WindowDesc _network_join_status_window_desc = { |
7837
65d7362153a6
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7817
diff
changeset
|
1627 |
WDP_CENTER, WDP_CENTER, 250, 85, 250, 85, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5920
diff
changeset
|
1628 |
WC_NETWORK_STATUS_WINDOW, WC_NONE, |
5683
dca046ba7aa3
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5682
diff
changeset
|
1629 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_MODAL, |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1630 |
_network_join_status_window_widget, |
0 | 1631 |
}; |
1632 |
||
6573 | 1633 |
void ShowJoinStatusWindow() |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1634 |
{ |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1635 |
DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0); |
10591
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1636 |
new NetworkJoinStatusWindow(&_network_join_status_window_desc); |
670
7c58dc46609c
(svn r1108) -Fix: [Network] Fixed problem around slow clients:
truelight
parents:
659
diff
changeset
|
1637 |
} |
0 | 1638 |
|
7027
f3d60745346d
(svn r9719) -Fix: in-game private messages did not work for clients with a Client ID > 255.
rubidium
parents:
6988
diff
changeset
|
1639 |
static void SendChat(const char *buf, DestType type, int dest) |
4013
a11adcc2a852
(svn r5226) Reduce the mess that sending chat messages is
tron
parents:
3860
diff
changeset
|
1640 |
{ |
7817
f24498d934ac
(svn r10684) -Codechange: some more coding style related changes. Primarily moving { to a new line.
rubidium
parents:
7717
diff
changeset
|
1641 |
if (StrEmpty(buf)) return; |
4013
a11adcc2a852
(svn r5226) Reduce the mess that sending chat messages is
tron
parents:
3860
diff
changeset
|
1642 |
if (!_network_server) { |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
1643 |
SEND_COMMAND(PACKET_CLIENT_CHAT)((NetworkAction)(NETWORK_ACTION_CHAT + type), type, dest, buf); |
4013
a11adcc2a852
(svn r5226) Reduce the mess that sending chat messages is
tron
parents:
3860
diff
changeset
|
1644 |
} else { |
10792
95b6eb9fcc9e
(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:
10784
diff
changeset
|
1645 |
NetworkServerSendChat((NetworkAction)(NETWORK_ACTION_CHAT + type), type, dest, buf, NETWORK_SERVER_INDEX); |
4013
a11adcc2a852
(svn r5226) Reduce the mess that sending chat messages is
tron
parents:
3860
diff
changeset
|
1646 |
} |
a11adcc2a852
(svn r5226) Reduce the mess that sending chat messages is
tron
parents:
3860
diff
changeset
|
1647 |
} |
a11adcc2a852
(svn r5226) Reduce the mess that sending chat messages is
tron
parents:
3860
diff
changeset
|
1648 |
|
4315
a0fc451fad6b
(svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents:
4300
diff
changeset
|
1649 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1650 |
struct NetworkChatWindow : public QueryStringBaseWindow { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1651 |
DestType dtype; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1652 |
int dest; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1653 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1654 |
NetworkChatWindow (const WindowDesc *desc, DestType type, int dest) : QueryStringBaseWindow(desc) |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1655 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1656 |
this->LowerWidget(2); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1657 |
this->dtype = type; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1658 |
this->dest = dest; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1659 |
this->afilter = CS_ALPHANUMERAL; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1660 |
InitializeTextBuffer(&this->text, this->edit_str_buf, lengthof(this->edit_str_buf), 0); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1661 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1662 |
InvalidateWindowData(WC_NEWS_WINDOW, 0, this->height); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1663 |
SetBit(_no_scroll, SCROLL_CHAT); // do not scroll the game with the arrow-keys |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1664 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1665 |
_chat_tab_completion_active = false; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1666 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1667 |
this->FindWindowPlacementAndResize(desc); |
4315
a0fc451fad6b
(svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents:
4300
diff
changeset
|
1668 |
} |
a0fc451fad6b
(svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents:
4300
diff
changeset
|
1669 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1670 |
~NetworkChatWindow () |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1671 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1672 |
InvalidateWindowData(WC_NEWS_WINDOW, 0, 0); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1673 |
ClrBit(_no_scroll, SCROLL_CHAT); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1674 |
} |
4315
a0fc451fad6b
(svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents:
4300
diff
changeset
|
1675 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1676 |
/** |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1677 |
* Find the next item of the list of things that can be auto-completed. |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1678 |
* @param item The current indexed item to return. This function can, and most |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1679 |
* likely will, alter item, to skip empty items in the arrays. |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1680 |
* @return Returns the char that matched to the index. |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1681 |
*/ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1682 |
const char *ChatTabCompletionNextItem(uint *item) |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1683 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1684 |
static char chat_tab_temp_buffer[64]; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1685 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1686 |
/* First, try clients */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1687 |
if (*item < MAX_CLIENT_INFO) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1688 |
/* Skip inactive clients */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1689 |
while (_network_client_info[*item].client_index == NETWORK_EMPTY_INDEX && *item < MAX_CLIENT_INFO) (*item)++; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1690 |
if (*item < MAX_CLIENT_INFO) return _network_client_info[*item].client_name; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1691 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1692 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1693 |
/* Then, try townnames */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1694 |
/* Not that the following assumes all town indices are adjacent, ie no |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1695 |
* towns have been deleted. */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1696 |
if (*item <= (uint)MAX_CLIENT_INFO + GetMaxTownIndex()) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1697 |
const Town *t; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1698 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1699 |
FOR_ALL_TOWNS_FROM(t, *item - MAX_CLIENT_INFO) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1700 |
/* Get the town-name via the string-system */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1701 |
SetDParam(0, t->index); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1702 |
GetString(chat_tab_temp_buffer, STR_TOWN, lastof(chat_tab_temp_buffer)); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1703 |
return &chat_tab_temp_buffer[0]; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1704 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1705 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1706 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1707 |
return NULL; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1708 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1709 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1710 |
/** |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1711 |
* Find what text to complete. It scans for a space from the left and marks |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1712 |
* the word right from that as to complete. It also writes a \0 at the |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1713 |
* position of the space (if any). If nothing found, buf is returned. |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1714 |
*/ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1715 |
static char *ChatTabCompletionFindText(char *buf) |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1716 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1717 |
char *p = strrchr(buf, ' '); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1718 |
if (p == NULL) return buf; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1719 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1720 |
*p = '\0'; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1721 |
return p + 1; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1722 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1723 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1724 |
/** |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1725 |
* See if we can auto-complete the current text of the user. |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1726 |
*/ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1727 |
void ChatTabCompletion() |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1728 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1729 |
static char _chat_tab_completion_buf[lengthof(this->edit_str_buf)]; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1730 |
Textbuf *tb = &this->text; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1731 |
size_t len, tb_len; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1732 |
uint item; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1733 |
char *tb_buf, *pre_buf; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1734 |
const char *cur_name; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1735 |
bool second_scan = false; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1736 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1737 |
item = 0; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1738 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1739 |
/* Copy the buffer so we can modify it without damaging the real data */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1740 |
pre_buf = (_chat_tab_completion_active) ? strdup(_chat_tab_completion_buf) : strdup(tb->buf); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1741 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1742 |
tb_buf = ChatTabCompletionFindText(pre_buf); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1743 |
tb_len = strlen(tb_buf); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1744 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1745 |
while ((cur_name = ChatTabCompletionNextItem(&item)) != NULL) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1746 |
item++; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1747 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1748 |
if (_chat_tab_completion_active) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1749 |
/* We are pressing TAB again on the same name, is there an other name |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1750 |
* that starts with this? */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1751 |
if (!second_scan) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1752 |
size_t offset; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1753 |
size_t length; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1754 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1755 |
/* If we are completing at the begin of the line, skip the ': ' we added */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1756 |
if (tb_buf == pre_buf) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1757 |
offset = 0; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1758 |
length = tb->length - 2; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1759 |
} else { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1760 |
/* Else, find the place we are completing at */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1761 |
offset = strlen(pre_buf) + 1; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1762 |
length = tb->length - offset; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1763 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1764 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1765 |
/* Compare if we have a match */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1766 |
if (strlen(cur_name) == length && strncmp(cur_name, tb->buf + offset, length) == 0) second_scan = true; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1767 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1768 |
continue; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1769 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1770 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1771 |
/* Now any match we make on _chat_tab_completion_buf after this, is perfect */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1772 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1773 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1774 |
len = strlen(cur_name); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1775 |
if (tb_len < len && strncasecmp(cur_name, tb_buf, tb_len) == 0) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1776 |
/* Save the data it was before completion */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1777 |
if (!second_scan) snprintf(_chat_tab_completion_buf, lengthof(_chat_tab_completion_buf), "%s", tb->buf); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1778 |
_chat_tab_completion_active = true; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1779 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1780 |
/* Change to the found name. Add ': ' if we are at the start of the line (pretty) */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1781 |
if (pre_buf == tb_buf) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1782 |
snprintf(tb->buf, lengthof(this->edit_str_buf), "%s: ", cur_name); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1783 |
} else { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1784 |
snprintf(tb->buf, lengthof(this->edit_str_buf), "%s %s", pre_buf, cur_name); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1785 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1786 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1787 |
/* Update the textbuffer */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1788 |
UpdateTextBufferSize(&this->text); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1789 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1790 |
this->SetDirty(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1791 |
free(pre_buf); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1792 |
return; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1793 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1794 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1795 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1796 |
if (second_scan) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1797 |
/* We walked all posibilities, and the user presses tab again.. revert to original text */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1798 |
strcpy(tb->buf, _chat_tab_completion_buf); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1799 |
_chat_tab_completion_active = false; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1800 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1801 |
/* Update the textbuffer */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1802 |
UpdateTextBufferSize(&this->text); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1803 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1804 |
this->SetDirty(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1805 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1806 |
free(pre_buf); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1807 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1808 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1809 |
virtual void OnPaint() |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1810 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1811 |
static const StringID chat_captions[] = { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1812 |
STR_NETWORK_CHAT_ALL_CAPTION, |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1813 |
STR_NETWORK_CHAT_COMPANY_CAPTION, |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1814 |
STR_NETWORK_CHAT_CLIENT_CAPTION |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1815 |
}; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1816 |
|
10595
7957c71b0dfe
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
10591
diff
changeset
|
1817 |
this->DrawWidgets(); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1818 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1819 |
assert((uint)this->dtype < lengthof(chat_captions)); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1820 |
DrawStringRightAligned(this->widget[2].left - 2, this->widget[2].top + 1, chat_captions[this->dtype], TC_BLACK); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1821 |
this->DrawEditBox(2); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1822 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1823 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1824 |
virtual void OnClick(Point pt, int widget) |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1825 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1826 |
switch (widget) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1827 |
case 2: |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1828 |
ShowOnScreenKeyboard(this, 2, 0, 3); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1829 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1830 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1831 |
case 3: /* Send */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1832 |
SendChat(this->text.buf, this->dtype, this->dest); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1833 |
/* FALLTHROUGH */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1834 |
case 0: /* Cancel */ delete this; break; |
4315
a0fc451fad6b
(svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents:
4300
diff
changeset
|
1835 |
} |
a0fc451fad6b
(svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents:
4300
diff
changeset
|
1836 |
} |
a0fc451fad6b
(svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents:
4300
diff
changeset
|
1837 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1838 |
virtual void OnMouseLoop() |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1839 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1840 |
this->HandleEditBox(2); |
4315
a0fc451fad6b
(svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents:
4300
diff
changeset
|
1841 |
} |
a0fc451fad6b
(svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents:
4300
diff
changeset
|
1842 |
|
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10596
diff
changeset
|
1843 |
virtual EventState OnKeyPress(uint16 key, uint16 keycode) |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1844 |
{ |
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10596
diff
changeset
|
1845 |
EventState state = ES_NOT_HANDLED; |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1846 |
if (keycode == WKC_TAB) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1847 |
ChatTabCompletion(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1848 |
} else { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1849 |
_chat_tab_completion_active = false; |
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10596
diff
changeset
|
1850 |
switch (this->HandleEditBoxKey(2, key, keycode, state)) { |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1851 |
case 1: /* Return */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1852 |
SendChat(this->text.buf, this->dtype, this->dest); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1853 |
/* FALLTHROUGH */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1854 |
case 2: /* Escape */ delete this; break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1855 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1856 |
} |
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10596
diff
changeset
|
1857 |
return state; |
4315
a0fc451fad6b
(svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents:
4300
diff
changeset
|
1858 |
} |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1859 |
}; |
649 | 1860 |
|
1861 |
static const Widget _chat_window_widgets[] = { |
|
9233
4daa9bb8dbf7
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
9224
diff
changeset
|
1862 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
4daa9bb8dbf7
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
9224
diff
changeset
|
1863 |
{ WWT_PANEL, RESIZE_RIGHT, 14, 11, 319, 0, 13, 0x0, STR_NULL}, // background |
4daa9bb8dbf7
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
9224
diff
changeset
|
1864 |
{ WWT_EDITBOX, RESIZE_RIGHT, 14, 75, 257, 1, 12, STR_NETWORK_CHAT_OSKTITLE, STR_NULL}, // text box |
4daa9bb8dbf7
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
9224
diff
changeset
|
1865 |
{ WWT_PUSHTXTBTN, RESIZE_LR, 14, 258, 319, 1, 12, STR_NETWORK_SEND, STR_NULL}, // send button |
649 | 1866 |
{ WIDGETS_END}, |
1867 |
}; |
|
1868 |
||
1869 |
static const WindowDesc _chat_window_desc = { |
|
7859
f0d341e69326
(svn r10726) -Codechange: make it possible that the chat window is less than 640 pixels.
rubidium
parents:
7839
diff
changeset
|
1870 |
WDP_CENTER, -26, 320, 14, 640, 14, // x, y, width, height |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5920
diff
changeset
|
1871 |
WC_SEND_NETWORK_MSG, WC_NONE, |
8515
d0401d967e99
(svn r11579) -Revert(r11578): some cases of key propagation are not handled correctly.
belugas
parents:
8514
diff
changeset
|
1872 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET, |
649 | 1873 |
_chat_window_widgets, |
1874 |
}; |
|
1875 |
||
7027
f3d60745346d
(svn r9719) -Fix: in-game private messages did not work for clients with a Client ID > 255.
rubidium
parents:
6988
diff
changeset
|
1876 |
void ShowNetworkChatQueryWindow(DestType type, int dest) |
649 | 1877 |
{ |
1878 |
DeleteWindowById(WC_SEND_NETWORK_MSG, 0); |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1879 |
new NetworkChatWindow (&_chat_window_desc, type, dest); |
649 | 1880 |
} |
1881 |
||
8494
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1882 |
/** Enum for NetworkGameWindow, referring to _network_game_window_widgets */ |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1883 |
enum NetworkCompanyPasswordWindowWidgets { |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1884 |
NCPWW_CLOSE, ///< Close 'X' button |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1885 |
NCPWW_CAPTION, ///< Caption of the whole window |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1886 |
NCPWW_BACKGROUND, ///< The background of the interface |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1887 |
NCPWW_LABEL, ///< Label in front of the password field |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1888 |
NCPWW_PASSWORD, ///< Input field for the password |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1889 |
NCPWW_SAVE_AS_DEFAULT_PASSWORD, ///< Toggle 'button' for saving the current password as default password |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1890 |
NCPWW_CANCEL, ///< Close the window without changing anything |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1891 |
NCPWW_OK, ///< Safe the password etc. |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1892 |
}; |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1893 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1894 |
struct NetworkCompanyPasswordWindow : public QueryStringBaseWindow { |
10563
76819f7c2dc2
(svn r13107) -Codechange: make NetworkCompanyPasswordWindow and SelectPlayerFaceWindow children of PlayerCompanyWindow.
glx
parents:
10502
diff
changeset
|
1895 |
NetworkCompanyPasswordWindow(const WindowDesc *desc, Window *parent) : QueryStringBaseWindow(desc) |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1896 |
{ |
10563
76819f7c2dc2
(svn r13107) -Codechange: make NetworkCompanyPasswordWindow and SelectPlayerFaceWindow children of PlayerCompanyWindow.
glx
parents:
10502
diff
changeset
|
1897 |
this->parent = parent; |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1898 |
this->afilter = CS_ALPHANUMERAL; |
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
1899 |
InitializeTextBuffer(&this->text, this->edit_str_buf, min(lengthof(_settings_client.network.default_company_pass), lengthof(this->edit_str_buf)), 0); |
8494
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1900 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1901 |
this->FindWindowPlacementAndResize(desc); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1902 |
} |
8494
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1903 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1904 |
void OnOk() |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1905 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1906 |
if (this->IsWidgetLowered(NCPWW_SAVE_AS_DEFAULT_PASSWORD)) { |
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
1907 |
snprintf(_settings_client.network.default_company_pass, lengthof(_settings_client.network.default_company_pass), "%s", this->edit_str_buf); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1908 |
} |
8583
3c3f27c720d6
(svn r11648) -Fix [FS#1560]: the company password was not set when one pressed the enter key.
rubidium
parents:
8578
diff
changeset
|
1909 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1910 |
/* empty password is a '*' because of console argument */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1911 |
if (StrEmpty(this->edit_str_buf)) snprintf(this->edit_str_buf, lengthof(this->edit_str_buf), "*"); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1912 |
char *password = this->edit_str_buf; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1913 |
NetworkChangeCompanyPassword(1, &password); |
8494
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1914 |
} |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1915 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1916 |
virtual void OnPaint() |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1917 |
{ |
10595
7957c71b0dfe
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
10591
diff
changeset
|
1918 |
this->DrawWidgets(); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1919 |
this->DrawEditBox(4); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1920 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1921 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1922 |
virtual void OnClick(Point pt, int widget) |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1923 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1924 |
switch (widget) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1925 |
case NCPWW_OK: |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1926 |
this->OnOk(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1927 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1928 |
/* FALL THROUGH */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1929 |
case NCPWW_CANCEL: |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1930 |
delete this; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1931 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1932 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1933 |
case NCPWW_SAVE_AS_DEFAULT_PASSWORD: |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1934 |
this->ToggleWidgetLoweredState(NCPWW_SAVE_AS_DEFAULT_PASSWORD); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1935 |
this->SetDirty(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1936 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1937 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1938 |
case NCPWW_PASSWORD: |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1939 |
ShowOnScreenKeyboard(this, NCPWW_PASSWORD, 2, 1); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1940 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1941 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1942 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1943 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1944 |
virtual void OnMouseLoop() |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1945 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1946 |
this->HandleEditBox(4); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1947 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1948 |
|
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10596
diff
changeset
|
1949 |
virtual EventState OnKeyPress(uint16 key, uint16 keycode) |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1950 |
{ |
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10596
diff
changeset
|
1951 |
EventState state; |
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10596
diff
changeset
|
1952 |
switch (this->HandleEditBoxKey(4, key, keycode, state)) { |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1953 |
case 1: // Return |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1954 |
this->OnOk(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1955 |
/* FALL THROUGH */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1956 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1957 |
case 2: // Escape |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1958 |
delete this; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1959 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1960 |
} |
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10596
diff
changeset
|
1961 |
return state; |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1962 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1963 |
}; |
8494
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1964 |
|
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1965 |
static const Widget _ncp_window_widgets[] = { |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1966 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1967 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 299, 0, 13, STR_COMPANY_PASSWORD_CAPTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1968 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 299, 14, 50, 0x0, STR_NULL}, |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1969 |
{ WWT_TEXT, RESIZE_NONE, 14, 5, 100, 19, 30, STR_COMPANY_PASSWORD, STR_NULL}, |
9233
4daa9bb8dbf7
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
9224
diff
changeset
|
1970 |
{ WWT_EDITBOX, RESIZE_NONE, 14, 101, 294, 19, 30, STR_SET_COMPANY_PASSWORD, STR_NULL}, |
8494
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1971 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 101, 294, 35, 46, STR_MAKE_DEFAULT_COMPANY_PASSWORD, STR_MAKE_DEFAULT_COMPANY_PASSWORD_TIP}, |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1972 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 149, 51, 62, STR_012E_CANCEL, STR_COMPANY_PASSWORD_CANCEL}, |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1973 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 150, 299, 51, 62, STR_012F_OK, STR_COMPANY_PASSWORD_OK}, |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1974 |
{ WIDGETS_END}, |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1975 |
}; |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1976 |
|
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1977 |
static const WindowDesc _ncp_window_desc = { |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1978 |
WDP_AUTO, WDP_AUTO, 300, 63, 300, 63, |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1979 |
WC_COMPANY_PASSWORD_WINDOW, WC_NONE, |
8515
d0401d967e99
(svn r11579) -Revert(r11578): some cases of key propagation are not handled correctly.
belugas
parents:
8514
diff
changeset
|
1980 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, |
8494
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1981 |
_ncp_window_widgets, |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1982 |
}; |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1983 |
|
10563
76819f7c2dc2
(svn r13107) -Codechange: make NetworkCompanyPasswordWindow and SelectPlayerFaceWindow children of PlayerCompanyWindow.
glx
parents:
10502
diff
changeset
|
1984 |
void ShowNetworkCompanyPasswordWindow(Window *parent) |
8494
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1985 |
{ |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1986 |
DeleteWindowById(WC_COMPANY_PASSWORD_WINDOW, 0); |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1987 |
|
10563
76819f7c2dc2
(svn r13107) -Codechange: make NetworkCompanyPasswordWindow and SelectPlayerFaceWindow children of PlayerCompanyWindow.
glx
parents:
10502
diff
changeset
|
1988 |
new NetworkCompanyPasswordWindow(&_ncp_window_desc, parent); |
8494
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1989 |
} |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1990 |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1991 |
#endif /* ENABLE_NETWORK */ |