author | Tero Marttila <terom@fixme.fi> |
Fri, 18 Jul 2008 21:16:18 +0300 | |
changeset 11174 | b29402c54ffe |
parent 11173 | 78f0d1cee01b |
child 11181 | 403550141f43 |
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" |
11174
b29402c54ffe
create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
11173
diff
changeset
|
24 |
#include "newgrf_download.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
|
25 |
#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
|
26 |
#include "../window_func.h" |
8709
4187ad809fe7
(svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium
parents:
8704
diff
changeset
|
27 |
#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
|
28 |
#include "../string_func.h" |
8720
4e60c30e2006
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8710
diff
changeset
|
29 |
#include "../gfx_func.h" |
8750
fdd6054e7bae
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
8720
diff
changeset
|
30 |
#include "../player_func.h" |
8766
c86cfa3a7580
(svn r11834) -Codechange: only include settings_type.h if needed.
rubidium
parents:
8760
diff
changeset
|
31 |
#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
|
32 |
#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
|
33 |
#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
|
34 |
#include "../sortlist_type.h" |
0 | 35 |
|
8760
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/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
|
37 |
#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
|
38 |
|
0 | 39 |
#define BGC 5 |
40 |
#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
|
41 |
|
4315
a0fc451fad6b
(svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents:
4300
diff
changeset
|
42 |
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
|
43 |
|
6573 | 44 |
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
|
45 |
static void ShowNetworkLobbyWindow(NetworkGameList *ngl); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
46 |
extern void SwitchMode(int new_mode); |
0 | 47 |
|
48 |
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
|
49 |
STR_NETWORK_LAN_INTERNET, |
b120ec0b3e39
(svn r1113) -Add: [Network] Added the GUI part for server advertising. When you go
truelight
parents:
670
diff
changeset
|
50 |
STR_NETWORK_INTERNET_ADVERTISE, |
0 | 51 |
INVALID_STRING_ID |
52 |
}; |
|
53 |
||
764
68b398e2b780
(svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents:
749
diff
changeset
|
54 |
static const StringID _lan_internet_types_dropdown[] = { |
68b398e2b780
(svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents:
749
diff
changeset
|
55 |
STR_NETWORK_LAN, |
68b398e2b780
(svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents:
749
diff
changeset
|
56 |
STR_NETWORK_INTERNET, |
68b398e2b780
(svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents:
749
diff
changeset
|
57 |
INVALID_STRING_ID |
68b398e2b780
(svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents:
749
diff
changeset
|
58 |
}; |
68b398e2b780
(svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents:
749
diff
changeset
|
59 |
|
7292
d4cf2baf26ae
(svn r10035) -Change: simplified network language string sorting
glx
parents:
7289
diff
changeset
|
60 |
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
|
61 |
|
7817
f24498d934ac
(svn r10684) -Codechange: some more coding style related changes. Primarily moving { to a new line.
rubidium
parents:
7717
diff
changeset
|
62 |
void SortNetworkLanguages() |
f24498d934ac
(svn r10684) -Codechange: some more coding style related changes. Primarily moving { to a new line.
rubidium
parents:
7717
diff
changeset
|
63 |
{ |
7292
d4cf2baf26ae
(svn r10035) -Change: simplified network language string sorting
glx
parents:
7289
diff
changeset
|
64 |
/* Init the strings */ |
d4cf2baf26ae
(svn r10035) -Change: simplified network language string sorting
glx
parents:
7289
diff
changeset
|
65 |
if (_language_dropdown[0] == STR_NULL) { |
d4cf2baf26ae
(svn r10035) -Change: simplified network language string sorting
glx
parents:
7289
diff
changeset
|
66 |
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
|
67 |
_language_dropdown[NETLANG_COUNT] = INVALID_STRING_ID; |
d4cf2baf26ae
(svn r10035) -Change: simplified network language string sorting
glx
parents:
7289
diff
changeset
|
68 |
} |
7289
d6a004877931
(svn r10032) -Add: sort the strings in server language dropdown
glx
parents:
7276
diff
changeset
|
69 |
|
7292
d4cf2baf26ae
(svn r10035) -Change: simplified network language string sorting
glx
parents:
7289
diff
changeset
|
70 |
/* 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
|
71 |
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
|
72 |
} |
7276
fdb2191fac67
(svn r10017) -Add (FS#790): more languages flags for servers
glx
parents:
7027
diff
changeset
|
73 |
|
211 | 74 |
enum { |
2881
1ffbbdbf1685
(svn r3429) - Feature (Followup): Change the gamelist window to accomodate for the new information.
Darkvater
parents:
2879
diff
changeset
|
75 |
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
|
76 |
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
|
77 |
NET_PRC__SIZE_OF_ROW = 14, |
211 | 78 |
}; |
79 |
||
5035
e5680cce4e67
(svn r7077) -Codechange: Send proper message to network window, and handle selection control in
Darkvater
parents:
4957
diff
changeset
|
80 |
/** 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
|
81 |
* found on the network. |
e5680cce4e67
(svn r7077) -Codechange: Send proper message to network window, and handle selection control in
Darkvater
parents:
4957
diff
changeset
|
82 |
* @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
|
83 |
void UpdateNetworkGameWindow(bool unselect) |
42412d5ecc64
(svn r1383) Fix: You can now also delete automatically found servers by pressing "del"
dominik
parents:
893
diff
changeset
|
84 |
{ |
10485
331014dcd0d3
(svn r13028) -Codechange: WE_MESSAGE and WE_INVALIDATE_DATA were doing the same thing.
rubidium
parents:
10484
diff
changeset
|
85 |
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
|
86 |
} |
42412d5ecc64
(svn r1383) Fix: You can now also delete automatically found servers by pressing "del"
dominik
parents:
893
diff
changeset
|
87 |
|
8456
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
88 |
/** 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
|
89 |
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
|
90 |
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
|
91 |
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
|
92 |
NGWW_RESIZE, ///< Resize button |
8456
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
93 |
|
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
|
94 |
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
|
95 |
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
|
96 |
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
|
97 |
|
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
|
98 |
NGWW_NAME, ///< 'Name' button |
8456
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
99 |
NGWW_CLIENTS, ///< 'Clients' button |
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
100 |
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
|
101 |
|
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
|
102 |
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
|
103 |
NGWW_SCROLLBAR, ///< Scrollbar of matrix |
8456
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
104 |
|
10178
8fde48e0ddac
(svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium
parents:
10170
diff
changeset
|
105 |
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
|
106 |
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
|
107 |
|
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
|
108 |
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
|
109 |
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
|
110 |
NGWW_REFRESH, ///< 'Refresh server' button |
11173
78f0d1cee01b
Add a "NewGRF Download" button to the server browser that's shown when there are incompatible NewGRFs
Tero Marttila <terom@fixme.fi>
parents:
11161
diff
changeset
|
111 |
NGWW_NEWGRF_DL, ///< 'NewGRF Download' button |
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_NEWGRF, ///< 'NewGRF Settings' button |
8456
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
113 |
|
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
|
114 |
NGWW_FIND, ///< 'Find server' button |
8456
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
115 |
NGWW_ADD, ///< 'Add server' button |
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
116 |
NGWW_START, ///< 'Start server' button |
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
117 |
NGWW_CANCEL, ///< 'Cancel' button |
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
118 |
}; |
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
119 |
|
10502
996d9308d650
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents:
10501
diff
changeset
|
120 |
typedef GUIList<NetworkGameList*> GUIGameServerList; |
996d9308d650
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents:
10501
diff
changeset
|
121 |
|
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
122 |
class NetworkGameWindow : public QueryStringBaseWindow { |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
123 |
protected: |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
124 |
/* Runtime saved values */ |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
125 |
static Listing last_sorting; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
126 |
|
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
127 |
/* Constants for sorting servers */ |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
128 |
static GUIGameServerList::SortFunction *const sorter_funcs[]; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
129 |
|
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
|
130 |
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
|
131 |
NetworkGameList *server; ///< selected server |
10502
996d9308d650
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents:
10501
diff
changeset
|
132 |
GUIGameServerList servers; ///< list with game servers. |
0 | 133 |
|
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
|
134 |
/** |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
* (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
|
136 |
* 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
|
137 |
*/ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
138 |
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
|
139 |
{ |
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
140 |
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
|
141 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
/* Create temporary array of games to use for listing */ |
10716
2406d1520245
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
10703
diff
changeset
|
143 |
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
|
144 |
|
10716
2406d1520245
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
10703
diff
changeset
|
145 |
for (NetworkGameList *ngl = _network_game_list; ngl != NULL; ngl = ngl->next) { |
2406d1520245
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
10703
diff
changeset
|
146 |
*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
|
147 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
148 |
|
10716
2406d1520245
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
10703
diff
changeset
|
149 |
this->servers.Compact(); |
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
150 |
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
|
151 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
152 |
|
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
153 |
/** Sort servers by name. */ |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
154 |
static int CDECL NGameNameSorter(NetworkGameList* const *a, NetworkGameList* const *b) |
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 |
return strcasecmp((*a)->info.server_name, (*b)->info.server_name); |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
157 |
} |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
158 |
|
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
159 |
/** Sort servers by the amount of clients online on a |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
160 |
* 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
|
161 |
* higher maximum is preferred. */ |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
162 |
static int CDECL NGameClientSorter(NetworkGameList* const *a, NetworkGameList* const *b) |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
163 |
{ |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
164 |
/* 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
|
165 |
int r = (*a)->info.clients_on - (*b)->info.clients_on; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
166 |
|
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
167 |
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
|
168 |
if (r == 0) r = NGameNameSorter(a, b); |
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 |
return r; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
171 |
} |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
172 |
|
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
173 |
/** Sort servers by joinability. If both servers are the |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
174 |
* same, prefer the non-passworded server first. */ |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
175 |
static int CDECL NGameAllowedSorter(NetworkGameList* const *a, NetworkGameList* const *b) |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
176 |
{ |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
177 |
/* 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
|
178 |
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
|
179 |
|
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
180 |
/* 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
|
181 |
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
|
182 |
/* 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
|
183 |
if (r == 0) r = (*b)->info.compatible - (*a)->info.compatible; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
184 |
/* Passworded servers should be below unpassworded servers */ |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
185 |
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
|
186 |
/* Finally sort on the name of the server */ |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
187 |
if (r == 0) r = NGameNameSorter(a, b); |
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 |
return r; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
190 |
} |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
191 |
|
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
192 |
/** 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
|
193 |
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
|
194 |
{ |
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
195 |
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
|
196 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
/* 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
|
198 |
* 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
|
199 |
* shuffling the ->next pointers */ |
10716
2406d1520245
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
10703
diff
changeset
|
200 |
_network_game_list = this->servers[0]; |
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
201 |
NetworkGameList *item = _network_game_list; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
202 |
for (uint i = 1; i != this->servers.Length(); i++) { |
10716
2406d1520245
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
10703
diff
changeset
|
203 |
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
|
204 |
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
|
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 |
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
|
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 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
/** |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
* 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
|
211 |
* @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
|
212 |
* @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
|
213 |
* @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
|
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 |
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
|
216 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
/* 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
|
218 |
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
|
219 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
220 |
SetDParamStr(0, cur_item->info.server_name); |
11157
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10882
diff
changeset
|
221 |
DrawStringTruncated(this->widget[NGWW_NAME].left + 5, y, STR_JUST_RAW_STRING, TC_BLACK, this->widget[NGWW_NAME].right - this->widget[NGWW_NAME].left - 5); |
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
|
222 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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(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
|
224 |
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
|
225 |
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
|
226 |
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
|
227 |
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
|
228 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
/* 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
|
230 |
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
|
231 |
/* 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
|
232 |
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
|
233 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
/* 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
|
235 |
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
|
236 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
/* 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
|
238 |
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
|
239 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
240 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
241 |
|
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
242 |
public: |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
243 |
NetworkGameWindow(const WindowDesc *desc) : QueryStringBaseWindow(desc) |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
244 |
{ |
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
245 |
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
|
246 |
this->afilter = CS_ALPHANUMERAL; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
247 |
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
|
248 |
|
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
249 |
UpdateNetworkGameWindow(true); |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
250 |
|
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
251 |
this->vscroll.cap = 11; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
252 |
this->resize.step_height = NET_PRC__SIZE_OF_ROW; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
253 |
|
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
254 |
this->field = NGWW_PLAYER; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
255 |
this->server = NULL; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
256 |
|
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
257 |
this->servers.SetListing(this->last_sorting); |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
258 |
this->servers.SetSortFuncs(this->sorter_funcs); |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
259 |
this->servers.ForceRebuild(); |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
260 |
this->SortNetworkGameList(); |
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 |
this->FindWindowPlacementAndResize(desc); |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
263 |
} |
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 |
~NetworkGameWindow() |
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 |
this->last_sorting = this->servers.GetListing(); |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
268 |
} |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
269 |
|
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
|
270 |
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
|
271 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
const NetworkGameList *sel = this->server; |
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
273 |
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
|
274 |
|
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
275 |
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
|
276 |
this->BuildNetworkGameList(); |
10716
2406d1520245
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
10703
diff
changeset
|
277 |
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
|
278 |
} |
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
279 |
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
|
280 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
/* '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
|
282 |
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
|
283 |
/* '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
|
284 |
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
|
285 |
!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
|
286 |
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
|
287 |
!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
|
288 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
/* '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
|
290 |
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
|
291 |
!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
|
292 |
sel->info.grfconfig == NULL); |
11173
78f0d1cee01b
Add a "NewGRF Download" button to the server browser that's shown when there are incompatible NewGRFs
Tero Marttila <terom@fixme.fi>
parents:
11161
diff
changeset
|
293 |
|
78f0d1cee01b
Add a "NewGRF Download" button to the server browser that's shown when there are incompatible NewGRFs
Tero Marttila <terom@fixme.fi>
parents:
11161
diff
changeset
|
294 |
/* 'NewGRF Download' button invisible if no incompatible NewGRFs are used */ |
78f0d1cee01b
Add a "NewGRF Download" button to the server browser that's shown when there are incompatible NewGRFs
Tero Marttila <terom@fixme.fi>
parents:
11161
diff
changeset
|
295 |
this->SetWidgetHiddenState(NGWW_NEWGRF_DL, sel == NULL || |
78f0d1cee01b
Add a "NewGRF Download" button to the server browser that's shown when there are incompatible NewGRFs
Tero Marttila <terom@fixme.fi>
parents:
11161
diff
changeset
|
296 |
!sel->online || |
78f0d1cee01b
Add a "NewGRF Download" button to the server browser that's shown when there are incompatible NewGRFs
Tero Marttila <terom@fixme.fi>
parents:
11161
diff
changeset
|
297 |
sel->info.compatible || !sel->info.version_compatible); |
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
|
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 |
SetDParam(0, 0x00); |
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
300 |
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
|
301 |
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
|
302 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
303 |
/* 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
|
304 |
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
|
305 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
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 |
/* Sort based on widgets: name, clients, compatibility */ |
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
309 |
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
|
310 |
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
|
311 |
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
|
312 |
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
|
313 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
314 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
315 |
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
|
316 |
|
10830
6f77385d473b
(svn r13380) -Fix (r13327): MSVC signed/unsigned warning
glx
parents:
10818
diff
changeset
|
317 |
const int max = min(this->vscroll.pos + this->vscroll.cap, (int)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
|
318 |
|
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
319 |
for (int i = this->vscroll.pos; i < max; ++i) { |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
320 |
const NetworkGameList *ngl = this->servers[i]; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
321 |
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
|
322 |
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
|
323 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
324 |
|
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
325 |
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
|
326 |
/* 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
|
327 |
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
|
328 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
329 |
/* 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
|
330 |
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
|
331 |
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
|
332 |
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
|
333 |
} 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
|
334 |
SetDParamStr(0, sel->info.server_name); |
11157
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10882
diff
changeset
|
335 |
DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, 68, STR_JUST_RAW_STRING, TC_ORANGE); // game 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
|
336 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
337 |
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
|
338 |
} 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
|
339 |
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
|
340 |
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
|
341 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
343 |
|
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
|
344 |
|
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
|
345 |
SetDParamStr(0, sel->info.server_name); |
11157
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10882
diff
changeset
|
346 |
DrawStringCenteredTruncated(this->widget[NGWW_DETAILS].left, this->widget[NGWW_DETAILS].right, 62, STR_JUST_RAW_STRING, TC_ORANGE); // game name |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
347 |
|
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
|
348 |
SetDParamStr(0, sel->info.map_name); |
11157
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10882
diff
changeset
|
349 |
DrawStringCenteredTruncated(this->widget[NGWW_DETAILS].left, this->widget[NGWW_DETAILS].right, 74, STR_JUST_RAW_STRING, 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
|
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, 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
|
352 |
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
|
353 |
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
|
354 |
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
|
355 |
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
|
356 |
y += 10; |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
357 |
|
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
|
358 |
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
|
359 |
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
|
360 |
y += 10; |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
361 |
|
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
|
362 |
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
|
363 |
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
|
364 |
y += 10; |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
365 |
|
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
|
366 |
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
|
367 |
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
|
368 |
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
|
369 |
y += 10; |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
370 |
|
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
|
371 |
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
|
372 |
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
|
373 |
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
|
374 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
376 |
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
|
377 |
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
|
378 |
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
|
379 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
380 |
SetDParam(0, sel->info.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
|
381 |
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
|
382 |
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
|
383 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
385 |
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
|
386 |
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
|
387 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
389 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
390 |
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
|
391 |
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
|
392 |
} 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
|
393 |
/* 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
|
394 |
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
|
395 |
} 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
|
396 |
DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, y, STR_NETWORK_PASSWORD, TC_FROMSTRING); // password warning |
2639 | 397 |
} |
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
|
398 |
|
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
|
399 |
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
|
400 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
402 |
|
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
|
403 |
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
|
404 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
406 |
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
|
407 |
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
|
408 |
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
|
409 |
break; |
741
39a3958887c1
(svn r1197) -Fix: [GUI] in r1194 someone deleted too much code from WE_KEYPRESS. Now
truelight
parents:
738
diff
changeset
|
410 |
|
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
|
411 |
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
|
412 |
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
|
413 |
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
|
414 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
415 |
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
|
416 |
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
|
417 |
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
|
418 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
419 |
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
|
420 |
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
|
421 |
case NGWW_INFO: // Connectivity (green dot) |
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
422 |
if (this->servers.SortType() == widget - NGWW_NAME) { |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
423 |
this->servers.ToggleSortOrder(); |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
424 |
} else { |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
425 |
this->servers.SetSortType(widget - NGWW_NAME); |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
426 |
this->servers.ForceResort(); |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
427 |
} |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
428 |
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
|
429 |
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
|
430 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
432 |
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
|
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 |
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
|
435 |
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
|
436 |
|
10778
2a163fb5571f
(svn r13328) -Fix (r13327): Don't access an item when there isn't any
skidd13
parents:
10777
diff
changeset
|
437 |
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
|
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 |
} 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
|
440 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
case NGWW_LASTJOINED: { |
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
442 |
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
|
443 |
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
|
444 |
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
|
445 |
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
|
446 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
447 |
} 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
|
448 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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_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
|
450 |
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
|
451 |
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
|
452 |
case 1: NetworkUDPQueryMasterServer(); break; |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
453 |
} |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
454 |
break; |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
455 |
|
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
|
456 |
case NGWW_ADD: // Add a server |
11157
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10882
diff
changeset
|
457 |
SetDParamStr(0, _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
|
458 |
ShowQueryString( |
11157
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10882
diff
changeset
|
459 |
STR_JUST_RAW_STRING, |
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
|
460 |
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
|
461 |
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
|
462 |
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
|
463 |
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
|
464 |
break; |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
465 |
|
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 |
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
|
467 |
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
|
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_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
|
471 |
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
|
472 |
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
|
473 |
_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
|
474 |
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
|
475 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
479 |
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
|
480 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
481 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
482 |
case NGWW_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
|
483 |
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
|
484 |
break; |
11173
78f0d1cee01b
Add a "NewGRF Download" button to the server browser that's shown when there are incompatible NewGRFs
Tero Marttila <terom@fixme.fi>
parents:
11161
diff
changeset
|
485 |
|
78f0d1cee01b
Add a "NewGRF Download" button to the server browser that's shown when there are incompatible NewGRFs
Tero Marttila <terom@fixme.fi>
parents:
11161
diff
changeset
|
486 |
case NGWW_NEWGRF_DL: // NewGRF Download |
11174
b29402c54ffe
create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
11173
diff
changeset
|
487 |
if (this->server != NULL) ShowNewGRFDownload(&this->server->info.grfconfig); |
11173
78f0d1cee01b
Add a "NewGRF Download" button to the server browser that's shown when there are incompatible NewGRFs
Tero Marttila <terom@fixme.fi>
parents:
11161
diff
changeset
|
488 |
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
|
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 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
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 |
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
|
495 |
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
|
496 |
_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
|
497 |
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
|
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 |
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
|
500 |
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
|
501 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
502 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
506 |
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
|
507 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
508 |
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
|
509 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
510 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
512 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
if (data != 0) this->server = NULL; |
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
514 |
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
|
515 |
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
|
516 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
517 |
|
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
|
518 |
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
|
519 |
{ |
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
|
520 |
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
|
521 |
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
|
522 |
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
|
523 |
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
|
524 |
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
|
525 |
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
|
526 |
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
|
527 |
} |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
528 |
} |
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
|
529 |
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
|
530 |
} |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
531 |
|
10780
1c73c1821c44
(svn r13330) -Fix: 'Player name' dialog was broken in two ways
smatz
parents:
10778
diff
changeset
|
532 |
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
|
533 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
534 |
/* 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
|
535 |
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
|
536 |
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
|
537 |
} else { |
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
538 |
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
|
539 |
} |
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
|
540 |
return state; |
0 | 541 |
} |
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
|
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 |
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
|
544 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
545 |
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
|
546 |
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
|
547 |
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
|
548 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
552 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
554 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
556 |
|
10716
2406d1520245
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
10703
diff
changeset
|
557 |
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
|
558 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
559 |
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
|
560 |
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
|
561 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
562 |
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
|
563 |
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
|
564 |
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
|
565 |
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
|
566 |
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
|
567 |
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
|
568 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
569 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
570 |
}; |
0 | 571 |
|
10777
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
572 |
Listing NetworkGameWindow::last_sorting = {false, 2}; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
573 |
GUIGameServerList::SortFunction *const NetworkGameWindow::sorter_funcs[] = { |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
574 |
&NGameNameSorter, |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
575 |
&NGameClientSorter, |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
576 |
&NGameAllowedSorter |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
577 |
}; |
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
578 |
|
54733fe334c5
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13
parents:
10775
diff
changeset
|
579 |
|
0 | 580 |
static const Widget _network_game_window_widgets[] = { |
8456
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
581 |
/* TOP */ |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
582 |
{ 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
|
583 |
{ 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
|
584 |
{ WWT_PANEL, RESIZE_RB, BGC, 0, 449, 14, 263, 0x0, STR_NULL}, // NGWW_RESIZE |
0 | 585 |
|
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
|
586 |
{ 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
|
587 |
{ 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
|
588 |
|
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
|
589 |
{ 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
|
590 |
|
8456
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
591 |
/* LEFT SIDE */ |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
592 |
{ 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
|
593 |
{ 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
|
594 |
{ 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
|
595 |
|
10178
8fde48e0ddac
(svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium
parents:
10170
diff
changeset
|
596 |
{ 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
|
597 |
{ 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
|
598 |
{ 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
|
599 |
{ 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
|
600 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
601 |
/* RIGHT SIDE */ |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
602 |
{ 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
|
603 |
|
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
604 |
{ 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
|
605 |
{ 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
|
606 |
|
11173
78f0d1cee01b
Add a "NewGRF Download" button to the server browser that's shown when there are incompatible NewGRFs
Tero Marttila <terom@fixme.fi>
parents:
11161
diff
changeset
|
607 |
{ WWT_PUSHTXTBTN, RESIZE_LRTB, BTC, 215, 315, 197, 208, STR_NEWGRF_DOWNLOAD_BUTTON, STR_NULL}, // NGWW_NEWGRF_DL |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
608 |
{ 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
|
609 |
|
8456
bec1891e42b5
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents:
8455
diff
changeset
|
610 |
/* BOTTOM */ |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
611 |
{ 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
|
612 |
{ 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
|
613 |
{ 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
|
614 |
{ 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
|
615 |
|
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
616 |
{ 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
|
617 |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
175
diff
changeset
|
618 |
{ WIDGETS_END}, |
0 | 619 |
}; |
620 |
||
621 |
static const WindowDesc _network_game_window_desc = { |
|
7839
5c43edaa9de0
(svn r10706) -Codechange: allow resizing the multiplayer server list window.
rubidium
parents:
7837
diff
changeset
|
622 |
WDP_CENTER, WDP_CENTER, 450, 264, 550, 264, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5920
diff
changeset
|
623 |
WC_NETWORK_WINDOW, WC_NONE, |
7839
5c43edaa9de0
(svn r10706) -Codechange: allow resizing the multiplayer server list window.
rubidium
parents:
7837
diff
changeset
|
624 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE, |
0 | 625 |
_network_game_window_widgets, |
626 |
}; |
|
627 |
||
6573 | 628 |
void ShowNetworkGameWindow() |
0 | 629 |
{ |
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
|
630 |
static bool first = true; |
0 | 631 |
DeleteWindowById(WC_NETWORK_WINDOW, 0); |
105 | 632 |
|
764
68b398e2b780
(svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents:
749
diff
changeset
|
633 |
/* 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
|
634 |
if (first) { |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
635 |
char * const *srv; |
2881
1ffbbdbf1685
(svn r3429) - Feature (Followup): Change the gamelist window to accomodate for the new information.
Darkvater
parents:
2879
diff
changeset
|
636 |
|
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
|
637 |
first = false; |
764
68b398e2b780
(svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents:
749
diff
changeset
|
638 |
// 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
|
639 |
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
|
640 |
NetworkAddServer(*srv); |
764
68b398e2b780
(svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents:
749
diff
changeset
|
641 |
} |
68b398e2b780
(svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents:
749
diff
changeset
|
642 |
} |
68b398e2b780
(svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents:
749
diff
changeset
|
643 |
|
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
|
644 |
new NetworkGameWindow(&_network_game_window_desc); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
645 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
646 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
647 |
enum { |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
648 |
NSSWND_START = 64, |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
649 |
NSSWND_ROWSIZE = 12 |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
650 |
}; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
651 |
|
8455
218ce4bc9b23
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents:
8427
diff
changeset
|
652 |
/** 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
|
653 |
enum NetworkStartServerWidgets { |
218ce4bc9b23
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents:
8427
diff
changeset
|
654 |
NSSW_CLOSE = 0, ///< Close 'X' button |
218ce4bc9b23
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents:
8427
diff
changeset
|
655 |
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
|
656 |
NSSW_SETPWD = 5, ///< 'Set password' button |
218ce4bc9b23
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents:
8427
diff
changeset
|
657 |
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
|
658 |
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
|
659 |
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
|
660 |
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
|
661 |
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
|
662 |
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
|
663 |
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
|
664 |
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
|
665 |
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
|
666 |
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
|
667 |
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
|
668 |
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
|
669 |
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
|
670 |
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
|
671 |
NSSW_CANCEL = 27, ///< 'Cancel' button |
8455
218ce4bc9b23
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents:
8427
diff
changeset
|
672 |
}; |
218ce4bc9b23
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents:
8427
diff
changeset
|
673 |
|
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
|
674 |
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
|
675 |
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
|
676 |
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
|
677 |
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
|
678 |
|
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
|
679 |
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
|
680 |
{ |
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
681 |
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
|
682 |
|
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
|
683 |
_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
|
684 |
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
|
685 |
this->vscroll.cap = 12; |
10808
d42b140d24f2
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
10792
diff
changeset
|
686 |
this->vscroll.count = _fios_items.Length(); |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
687 |
|
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
|
688 |
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
|
689 |
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
|
690 |
|
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
|
691 |
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
|
692 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
693 |
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
|
694 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
697 |
{ |
10808
d42b140d24f2
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
10792
diff
changeset
|
698 |
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
|
699 |
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
|
700 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
/* draw basic widgets */ |
10882
f047317b321c
(svn r13433) -Codechange: remove a now useless global variable.
rubidium
parents:
10830
diff
changeset
|
702 |
SetDParam(1, _connection_types_dropdown[_settings_client.network.server_advertise]); |
10818
95a5bba4e812
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents:
10808
diff
changeset
|
703 |
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
|
704 |
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
|
705 |
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
|
706 |
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
|
707 |
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
|
708 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
/* 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
|
710 |
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
|
711 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
/* 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
|
713 |
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
|
714 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
/* 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
|
716 |
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
|
717 |
|
10808
d42b140d24f2
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
10792
diff
changeset
|
718 |
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
|
719 |
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
|
720 |
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
|
721 |
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
|
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 (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
|
724 |
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
|
725 |
} 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
|
726 |
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
|
727 |
} |
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
|
728 |
y += NSSWND_ROWSIZE; |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
729 |
|
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
|
730 |
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
|
731 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
} |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
733 |
|
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
|
734 |
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
|
735 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
736 |
if (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
|
737 |
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
|
738 |
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
|
739 |
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
|
740 |
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
|
741 |
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
|
742 |
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
|
743 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
745 |
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
|
746 |
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
|
747 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
748 |
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
|
749 |
this->widget_id = NSSW_SETPWD; |
11157
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10882
diff
changeset
|
750 |
SetDParamStr(0, _settings_client.network.server_password); |
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10882
diff
changeset
|
751 |
ShowQueryString(STR_JUST_RAW_STRING, 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
|
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_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
|
755 |
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
|
756 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
758 |
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
|
759 |
|
10808
d42b140d24f2
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
10792
diff
changeset
|
760 |
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
|
761 |
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
|
762 |
} 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
|
763 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
764 |
case NSSW_CONNTYPE_BTN: // Connection type |
10882
f047317b321c
(svn r13433) -Codechange: remove a now useless global variable.
rubidium
parents:
10830
diff
changeset
|
765 |
ShowDropDownMenu(this, _connection_types_dropdown, _settings_client.network.server_advertise, NSSW_CONNTYPE_BTN, 0, 0); // do it for widget NSSW_CONNTYPE_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
|
766 |
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
|
767 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
769 |
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
|
770 |
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
|
771 |
/* 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
|
772 |
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
|
773 |
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
|
774 |
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
|
775 |
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
|
776 |
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
|
777 |
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
|
778 |
_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
|
779 |
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
|
780 |
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
|
781 |
_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
|
782 |
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
|
783 |
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
|
784 |
_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
|
785 |
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
|
786 |
} |
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
|
787 |
} |
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
|
788 |
_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
|
789 |
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
|
790 |
|
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
|
791 |
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
|
792 |
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
|
793 |
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
|
794 |
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
|
795 |
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
|
796 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
798 |
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
|
799 |
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
|
800 |
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
|
801 |
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
|
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 |
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
|
804 |
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
|
805 |
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
|
806 |
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
|
807 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
808 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
810 |
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
|
811 |
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
|
812 |
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
|
813 |
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
|
814 |
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
|
815 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
818 |
} 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
|
819 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
821 |
_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
|
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 |
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
|
824 |
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
|
825 |
} 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
|
826 |
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
|
827 |
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
|
828 |
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
|
829 |
_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
|
830 |
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
|
831 |
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
|
832 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
833 |
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
|
834 |
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
|
835 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
838 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
840 |
_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
|
841 |
/* 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
|
842 |
* 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
|
843 |
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
|
844 |
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
|
845 |
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
|
846 |
} |
0 | 847 |
} |
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
|
848 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
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 |
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
|
852 |
case NSSW_CONNTYPE_BTN: |
10882
f047317b321c
(svn r13433) -Codechange: remove a now useless global variable.
rubidium
parents:
10830
diff
changeset
|
853 |
_settings_client.network.server_advertise = (index != 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
|
854 |
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
|
855 |
case NSSW_LANGUAGE_BTN: |
10818
95a5bba4e812
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents:
10808
diff
changeset
|
856 |
_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
|
857 |
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
|
858 |
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
|
859 |
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
|
860 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
861 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
862 |
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
|
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 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
865 |
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
|
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 |
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
|
868 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
|
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
|
870 |
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
|
871 |
{ |
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
|
872 |
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
|
873 |
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
|
874 |
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
|
875 |
|
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
876 |
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
|
877 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
|
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
|
879 |
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
|
880 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
881 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
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 |
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
|
885 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
886 |
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
|
887 |
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
|
888 |
} 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
|
889 |
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
|
890 |
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
|
891 |
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
|
892 |
default: NOT_REACHED(); |
10818
95a5bba4e812
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents:
10808
diff
changeset
|
893 |
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
|
894 |
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
|
895 |
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
|
896 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
897 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
898 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
899 |
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
|
900 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
901 |
}; |
0 | 902 |
|
903 |
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
|
904 |
/* Window decoration and background panel */ |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
905 |
{ 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
|
906 |
{ 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
|
907 |
{ 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
|
908 |
|
8455
218ce4bc9b23
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents:
8427
diff
changeset
|
909 |
/* Set game name and password widgets */ |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
910 |
{ 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
|
911 |
{ 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
|
912 |
{ 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
|
913 |
|
8455
218ce4bc9b23
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents:
8427
diff
changeset
|
914 |
/* List of playable scenarios */ |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
915 |
{ 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
|
916 |
{ 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
|
917 |
{ 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
|
918 |
|
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
|
919 |
/* 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
|
920 |
{ 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
|
921 |
{ 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
|
922 |
|
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
923 |
{ 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
|
924 |
{ 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
|
925 |
{ 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
|
926 |
{ 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
|
927 |
|
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
928 |
{ 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
|
929 |
{ 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
|
930 |
{ 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
|
931 |
{ 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
|
932 |
|
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
933 |
{ 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
|
934 |
{ 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
|
935 |
{ 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
|
936 |
{ 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
|
937 |
|
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
938 |
{ 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
|
939 |
{ 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
|
940 |
|
218ce4bc9b23
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents:
8427
diff
changeset
|
941 |
/* Buttons Start / Load / Cancel */ |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
942 |
{ 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
|
943 |
{ 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
|
944 |
{ 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
|
945 |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
175
diff
changeset
|
946 |
{ WIDGETS_END}, |
0 | 947 |
}; |
948 |
||
949 |
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
|
950 |
WDP_CENTER, WDP_CENTER, 420, 244, 420, 244, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5920
diff
changeset
|
951 |
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
|
952 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
0 | 953 |
_network_start_server_window_widgets, |
954 |
}; |
|
955 |
||
6573 | 956 |
static void ShowNetworkStartServerWindow() |
0 | 957 |
{ |
958 |
DeleteWindowById(WC_NETWORK_WINDOW, 0); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
959 |
|
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
|
960 |
new NetworkStartServerWindow(&_network_start_server_window_desc); |
0 | 961 |
} |
962 |
||
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
963 |
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
|
964 |
{ |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
965 |
/* 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
|
966 |
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
|
967 |
if (_network_player_info[i].company_name[0] != '\0') { |
2639 | 968 |
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
|
969 |
} |
018e549265ed
(svn r1186) -Fix: [Network] You can now join a company on a server where a company
truelight
parents:
722
diff
changeset
|
970 |
} |
018e549265ed
(svn r1186) -Fix: [Network] You can now join a company on a server where a company
truelight
parents:
722
diff
changeset
|
971 |
|
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
972 |
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
|
973 |
} |
018e549265ed
(svn r1186) -Fix: [Network] You can now join a company on a server where a company
truelight
parents:
722
diff
changeset
|
974 |
|
8459
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
975 |
/** 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
|
976 |
enum NetworkLobbyWindowWidgets { |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
977 |
NLWW_CLOSE = 0, ///< Close 'X' button |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
978 |
NLWW_MATRIX = 5, ///< List of companies |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
979 |
NLWW_DETAILS = 7, ///< Company details |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
980 |
NLWW_JOIN = 8, ///< 'Join company' button |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
981 |
NLWW_NEW = 9, ///< 'New company' button |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
982 |
NLWW_SPECTATE = 10, ///< 'Spectate game' button |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
983 |
NLWW_REFRESH = 11, ///< 'Refresh server' button |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
984 |
NLWW_CANCEL = 12, ///< 'Cancel' button |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
985 |
}; |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
986 |
|
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
987 |
struct NetworkLobbyWindow : public Window { |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
988 |
PlayerID company; ///< Select company |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
989 |
NetworkGameList *server; ///< Selected server |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
990 |
|
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
991 |
NetworkLobbyWindow(const WindowDesc *desc, NetworkGameList *ngl) : |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
992 |
Window(desc), company(INVALID_PLAYER), server(ngl) |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
993 |
{ |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
994 |
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
|
995 |
|
f198d0a1aab7
(svn r13041) -Fix: calling a virtual function on a not fully constructed object is bound to cause errors.
rubidium
parents:
10497
diff
changeset
|
996 |
this->FindWindowPlacementAndResize(desc); |
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
997 |
} |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
998 |
|
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
999 |
virtual void OnPaint() |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1000 |
{ |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1001 |
const NetworkGameInfo *gi = &this->server->info; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1002 |
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
|
1003 |
|
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1004 |
/* Join button is disabled when no company is selected */ |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1005 |
this->SetWidgetDisabledState(NLWW_JOIN, this->company == INVALID_PLAYER); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1006 |
/* Cannot start new company if there are too many */ |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1007 |
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
|
1008 |
/* Cannot spectate if there are too many spectators */ |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1009 |
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
|
1010 |
|
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1011 |
/* Draw window widgets */ |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1012 |
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
|
1013 |
this->DrawWidgets(); |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1014 |
|
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1015 |
/* Draw company list */ |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1016 |
pos = this->vscroll.pos; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1017 |
while (pos < gi->companies_on) { |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1018 |
byte company = NetworkLobbyFindCompanyIndex(pos); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1019 |
bool income = false; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1020 |
if (this->company == company) { |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1021 |
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
|
1022 |
} |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1023 |
|
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1024 |
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
|
1025 |
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
|
1026 |
|
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1027 |
/* 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
|
1028 |
if (_network_player_info[company].income >= 0) income = true; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1029 |
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
|
1030 |
|
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1031 |
pos++; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1032 |
y += NET_PRC__SIZE_OF_ROW; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1033 |
if (pos >= this->vscroll.cap) break; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1034 |
} |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1035 |
|
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1036 |
/* 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
|
1037 |
GfxFillRect(174, 39, 403, 75, 157); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1038 |
DrawStringCentered(290, 50, STR_NETWORK_COMPANY_INFO, TC_FROMSTRING); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1039 |
if (this->company != INVALID_PLAYER) { |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1040 |
const uint x = 183; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1041 |
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
|
1042 |
y = 80; |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1043 |
|
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1044 |
SetDParam(0, gi->clients_on); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1045 |
SetDParam(1, gi->clients_max); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1046 |
SetDParam(2, gi->companies_on); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1047 |
SetDParam(3, gi->companies_max); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1048 |
DrawString(x, y, STR_NETWORK_CLIENTS, TC_GOLD); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1049 |
y += 10; |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1050 |
|
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1051 |
SetDParamStr(0, _network_player_info[this->company].company_name); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1052 |
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
|
1053 |
y += 10; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1054 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1055 |
SetDParam(0, _network_player_info[this->company].inaugurated_year); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1056 |
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
|
1057 |
y += 10; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1058 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1059 |
SetDParam(0, _network_player_info[this->company].company_value); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1060 |
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
|
1061 |
y += 10; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1062 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1063 |
SetDParam(0, _network_player_info[this->company].money); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1064 |
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
|
1065 |
y += 10; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1066 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1067 |
SetDParam(0, _network_player_info[this->company].income); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1068 |
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
|
1069 |
y += 10; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1070 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1071 |
SetDParam(0, _network_player_info[this->company].performance); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1072 |
DrawString(x, y, STR_NETWORK_PERFORMANCE, TC_GOLD); // performance |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1073 |
y += 10; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1074 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1075 |
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
|
1076 |
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
|
1077 |
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
|
1078 |
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
|
1079 |
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
|
1080 |
DrawString(x, y, STR_NETWORK_VEHICLES, TC_GOLD); // vehicles |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1081 |
y += 10; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1082 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1083 |
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
|
1084 |
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
|
1085 |
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
|
1086 |
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
|
1087 |
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
|
1088 |
DrawString(x, y, STR_NETWORK_STATIONS, TC_GOLD); // stations |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1089 |
y += 10; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1090 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1091 |
SetDParamStr(0, _network_player_info[this->company].players); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1092 |
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
|
1093 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1094 |
} |
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1095 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1096 |
virtual void OnClick(Point pt, int widget) |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1097 |
{ |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1098 |
switch (widget) { |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1099 |
case NLWW_CLOSE: // Close 'X' |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1100 |
case NLWW_CANCEL: // Cancel button |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1101 |
ShowNetworkGameWindow(); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1102 |
break; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1103 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1104 |
case NLWW_MATRIX: { // Company list |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1105 |
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
|
1106 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1107 |
if (id_v >= this->vscroll.cap) break; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1108 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1109 |
id_v += this->vscroll.pos; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1110 |
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
|
1111 |
this->SetDirty(); |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1112 |
} break; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1113 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1114 |
case NLWW_JOIN: // Join company |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1115 |
/* Button can be clicked only when it is enabled */ |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1116 |
_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
|
1117 |
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
|
1118 |
break; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1119 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1120 |
case NLWW_NEW: // New company |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1121 |
_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
|
1122 |
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
|
1123 |
break; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1124 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1125 |
case NLWW_SPECTATE: // Spectate game |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1126 |
_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
|
1127 |
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
|
1128 |
break; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1129 |
|
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1130 |
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
|
1131 |
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
|
1132 |
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
|
1133 |
break; |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1134 |
} |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1135 |
} |
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1136 |
}; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1137 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1138 |
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
|
1139 |
{ 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
|
1140 |
{ 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
|
1141 |
{ 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
|
1142 |
{ 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
|
1143 |
|
8459
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
1144 |
/* company list */ |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
1145 |
{ 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
|
1146 |
{ 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
|
1147 |
{ 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
|
1148 |
|
8459
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
1149 |
/* company/player info */ |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
1150 |
{ 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
|
1151 |
|
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
1152 |
/* buttons */ |
fc93bfaeca2e
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents:
8457
diff
changeset
|
1153 |
{ 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
|
1154 |
{ 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
|
1155 |
{ 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
|
1156 |
{ 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
|
1157 |
{ 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
|
1158 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1159 |
{ WIDGETS_END}, |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1160 |
}; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1161 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1162 |
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
|
1163 |
WDP_CENTER, WDP_CENTER, 420, 235, 420, 235, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5920
diff
changeset
|
1164 |
WC_NETWORK_WINDOW, WC_NONE, |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1165 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1166 |
_network_lobby_window_widgets, |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1167 |
}; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1168 |
|
2888
0972346d11a8
(svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents:
2887
diff
changeset
|
1169 |
/* 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
|
1170 |
* @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
|
1171 |
static void ShowNetworkLobbyWindow(NetworkGameList *ngl) |
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 |
DeleteWindowById(WC_NETWORK_WINDOW, 0); |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1174 |
|
10784
c3c7b558b4f1
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium
parents:
10780
diff
changeset
|
1175 |
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
|
1176 |
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
|
1177 |
|
10497
9ab9ea3ec4d1
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents:
10485
diff
changeset
|
1178 |
new NetworkLobbyWindow(&_network_lobby_window_desc, ngl); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1179 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1180 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1181 |
// The window below gives information about the connected clients |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1182 |
// 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
|
1183 |
// and stuff like that. |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1184 |
|
3692 | 1185 |
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
|
1186 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1187 |
// Every action must be of this form |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1188 |
typedef void ClientList_Action_Proc(byte client_no); |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1189 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1190 |
// Max 10 actions per client |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1191 |
#define MAX_CLIENTLIST_ACTION 10 |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1192 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1193 |
enum { |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1194 |
CLNWND_OFFSET = 16, |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1195 |
CLNWND_ROWSIZE = 10 |
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 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
853
diff
changeset
|
1198 |
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
|
1199 |
{ 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
|
1200 |
{ 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
|
1201 |
{ 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
|
1202 |
|
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1203 |
{ 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
|
1204 |
{ WIDGETS_END}, |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1205 |
}; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1206 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
853
diff
changeset
|
1207 |
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
|
1208 |
{ 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
|
1209 |
{ WIDGETS_END}, |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1210 |
}; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1211 |
|
10641
13148f508e6d
(svn r13185) -Codechange: remove everything related to the WindowProc callbacks.
rubidium
parents:
10625
diff
changeset
|
1212 |
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
|
1213 |
WDP_AUTO, WDP_AUTO, 250, 1, 250, 1, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5920
diff
changeset
|
1214 |
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
|
1215 |
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
|
1216 |
_client_list_widgets, |
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 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1219 |
// Finds the Xth client-info that is active |
4171 | 1220 |
static const NetworkClientInfo *NetworkFindClientInfo(byte client_no) |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1221 |
{ |
4171 | 1222 |
const NetworkClientInfo *ci; |
2630 | 1223 |
|
4883
801b93ae218c
(svn r6820) -Codechange: Some more const correctness, coding style.
Darkvater
parents:
4880
diff
changeset
|
1224 |
FOR_ALL_ACTIVE_CLIENT_INFOS(ci) { |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1225 |
if (client_no == 0) return ci; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1226 |
client_no--; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1227 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1228 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1229 |
return NULL; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1230 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1231 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1232 |
// 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
|
1233 |
static void ClientList_Kick(byte client_no) |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1234 |
{ |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1235 |
if (client_no < MAX_PLAYERS) |
4880
0708f34e3586
(svn r6816) -Codechange: Some coding style, variable localization, const correctness.
Darkvater
parents:
4878
diff
changeset
|
1236 |
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
|
1237 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1238 |
|
841
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
827
diff
changeset
|
1239 |
static void ClientList_Ban(byte client_no) |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1240 |
{ |
841
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
827
diff
changeset
|
1241 |
uint32 ip = NetworkFindClientInfo(client_no)->client_ip; |
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
827
diff
changeset
|
1242 |
|
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1243 |
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
|
1244 |
if (_network_ban_list[i] == NULL) { |
841
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
827
diff
changeset
|
1245 |
_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
|
1246 |
break; |
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
827
diff
changeset
|
1247 |
} |
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
827
diff
changeset
|
1248 |
} |
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
827
diff
changeset
|
1249 |
|
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1250 |
if (client_no < MAX_PLAYERS) { |
4880
0708f34e3586
(svn r6816) -Codechange: Some coding style, variable localization, const correctness.
Darkvater
parents:
4878
diff
changeset
|
1251 |
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
|
1252 |
} |
841
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
827
diff
changeset
|
1253 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1254 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1255 |
static void ClientList_GiveMoney(byte client_no) |
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) { |
4878
744717de172e
(svn r6814) -Codechange: For network games ci->client_playas was always p->index + 1. To
Darkvater
parents:
4861
diff
changeset
|
1258 |
ShowNetworkGiveMoneyWindow(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_SpeakToClient(byte client_no) |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1263 |
{ |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1264 |
if (NetworkFindClientInfo(client_no) != NULL) { |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1265 |
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
|
1266 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1267 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1268 |
|
4906
8a10678a62a3
(svn r6876) -Codechange: Change the naming of _PLAYER in DESTTYPE_PLAYER/NETWORK_ACTION_CHAT_PLAYER
Darkvater
parents:
4895
diff
changeset
|
1269 |
static void ClientList_SpeakToCompany(byte client_no) |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1270 |
{ |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1271 |
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
|
1272 |
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
|
1273 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1274 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1275 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1276 |
static void ClientList_SpeakToAll(byte client_no) |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1277 |
{ |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1278 |
ShowNetworkChatQueryWindow(DESTTYPE_BROADCAST, 0); |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1279 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1280 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1281 |
static void ClientList_None(byte client_no) |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1282 |
{ |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1283 |
/* No action ;) */ |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1284 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1285 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1286 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1287 |
|
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1288 |
struct NetworkClientListPopupWindow : Window { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1289 |
int sel_index; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1290 |
int client_no; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1291 |
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
|
1292 |
ClientList_Action_Proc *proc[MAX_CLIENTLIST_ACTION]; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1293 |
|
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1294 |
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
|
1295 |
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
|
1296 |
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
|
1297 |
{ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1298 |
/* |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1299 |
* 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
|
1300 |
* 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
|
1301 |
*/ |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1302 |
|
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1303 |
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
|
1304 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1305 |
int i = 0; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1306 |
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
|
1307 |
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
|
1308 |
this->proc[i++] = &ClientList_SpeakToClient; |
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 |
|
11161
7d0fac8f14cd
(svn r13719) -Codechange: rename IsValidPlayer to IsValidPlayerID in line with all other structs/classes that are in a pool.
rubidium
parents:
11157
diff
changeset
|
1311 |
if (IsValidPlayerID(ci->client_playas) || ci->client_playas == PLAYER_SPECTATOR) { |
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1312 |
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
|
1313 |
this->proc[i++] = &ClientList_SpeakToCompany; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1314 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1315 |
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
|
1316 |
this->proc[i++] = &ClientList_SpeakToAll; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1317 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1318 |
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
|
1319 |
/* We are no spectator and the player we want to give money to is no spectator and money gifts are allowed */ |
11161
7d0fac8f14cd
(svn r13719) -Codechange: rename IsValidPlayer to IsValidPlayerID in line with all other structs/classes that are in a pool.
rubidium
parents:
11157
diff
changeset
|
1320 |
if (IsValidPlayerID(_network_playas) && IsValidPlayerID(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
|
1321 |
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
|
1322 |
this->proc[i++] = &ClientList_GiveMoney; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1323 |
} |
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 |
/* 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
|
1327 |
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
|
1328 |
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
|
1329 |
this->proc[i++] = &ClientList_Kick; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1330 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1331 |
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
|
1332 |
this->proc[i++] = &ClientList_Ban; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1333 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1334 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1335 |
if (i == 0) { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1336 |
GetString(this->action[i], STR_NETWORK_CLIENTLIST_NONE, lastof(this->action[i])); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1337 |
this->proc[i++] = &ClientList_None; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1338 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1339 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1340 |
/* Calculate the height */ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1341 |
int h = ClientListPopupHeight(); |
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 |
/* Allocate the popup */ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1344 |
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
|
1345 |
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
|
1346 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1347 |
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
|
1348 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1349 |
this->FindWindowPlacementAndResize(150, h + 1); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1350 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1351 |
|
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1352 |
/** |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1353 |
* 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
|
1354 |
*/ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1355 |
void HandleClientListPopupClick(byte index) |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1356 |
{ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1357 |
/* 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
|
1358 |
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
|
1359 |
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
|
1360 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1361 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1362 |
|
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1363 |
/** |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1364 |
* 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
|
1365 |
*/ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1366 |
uint ClientListPopupHeight() |
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 |
int num = 0; |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
853
diff
changeset
|
1369 |
|
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1370 |
// Find the amount of actions |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1371 |
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
|
1372 |
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
|
1373 |
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
|
1374 |
num++; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1375 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1376 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1377 |
num *= CLNWND_ROWSIZE; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1378 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1379 |
return num + 1; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1380 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1381 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1382 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1383 |
virtual void OnPaint() |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1384 |
{ |
10595
7957c71b0dfe
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
10591
diff
changeset
|
1385 |
this->DrawWidgets(); |
10564
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 |
/* Draw the actions */ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1388 |
int sel = this->sel_index; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1389 |
int y = 1; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1390 |
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
|
1391 |
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
|
1392 |
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
|
1393 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1394 |
TextColour colour; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1395 |
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
|
1396 |
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
|
1397 |
colour = TC_WHITE; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1398 |
} else { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1399 |
colour = TC_BLACK; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1400 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1401 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1402 |
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
|
1403 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1404 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1405 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1406 |
virtual void OnMouseLoop() |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1407 |
{ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1408 |
/* We selected an action */ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1409 |
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
|
1410 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1411 |
if (_left_button_down) { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1412 |
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
|
1413 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1414 |
this->sel_index = index; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1415 |
this->SetDirty(); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1416 |
} else { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1417 |
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
|
1418 |
HandleClientListPopupClick(index); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1419 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1420 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1421 |
DeleteWindowById(WC_TOOLBAR_MENU, 0); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1422 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1423 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1424 |
}; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1425 |
|
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1426 |
/** |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1427 |
* Show the popup (action list) |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1428 |
*/ |
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1429 |
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
|
1430 |
{ |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1431 |
DeleteWindowById(WC_TOOLBAR_MENU, 0); |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1432 |
|
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1433 |
if (NetworkFindClientInfo(client_no) == NULL) return; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1434 |
|
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1435 |
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
|
1436 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1437 |
|
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1438 |
/** |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1439 |
* Main handle for clientlist |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1440 |
*/ |
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1441 |
struct NetworkClientListWindow : Window |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1442 |
{ |
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1443 |
byte selected_item; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1444 |
byte selected_y; |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1445 |
|
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1446 |
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
|
1447 |
Window(desc, window_number), |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1448 |
selected_item(0), |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1449 |
selected_y(255) |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1450 |
{ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1451 |
this->FindWindowPlacementAndResize(desc); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1452 |
} |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1453 |
|
10564
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 |
* 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
|
1456 |
*/ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1457 |
bool CheckClientListHeight() |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1458 |
{ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1459 |
int num = 0; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1460 |
const NetworkClientInfo *ci; |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1461 |
|
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1462 |
/* 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
|
1463 |
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
|
1464 |
num++; |
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 |
num *= CLNWND_ROWSIZE; |
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 |
/* If height is changed */ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1470 |
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
|
1471 |
// 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
|
1472 |
this->SetDirty(); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1473 |
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
|
1474 |
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
|
1475 |
this->SetDirty(); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1476 |
return false; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1477 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1478 |
return true; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1479 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1480 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1481 |
virtual void OnPaint() |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1482 |
{ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1483 |
NetworkClientInfo *ci; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1484 |
int i = 0; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1485 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1486 |
/* 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
|
1487 |
if (!this->CheckClientListHeight()) return; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1488 |
|
10595
7957c71b0dfe
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
10591
diff
changeset
|
1489 |
this->DrawWidgets(); |
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1490 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1491 |
int y = CLNWND_OFFSET; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1492 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1493 |
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
|
1494 |
TextColour colour; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1495 |
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
|
1496 |
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
|
1497 |
colour = TC_WHITE; |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4013
diff
changeset
|
1498 |
} else { |
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1499 |
colour = TC_BLACK; |
2639 | 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 |
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
|
1503 |
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
|
1504 |
} else { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1505 |
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
|
1506 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1507 |
|
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1508 |
/* Filter out spectators */ |
11161
7d0fac8f14cd
(svn r13719) -Codechange: rename IsValidPlayer to IsValidPlayerID in line with all other structs/classes that are in a pool.
rubidium
parents:
11157
diff
changeset
|
1509 |
if (IsValidPlayerID(ci->client_playas)) DrawPlayerIcon(ci->client_playas, 64, y + 1); |
10564
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 |
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
|
1512 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1513 |
y += CLNWND_ROWSIZE; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1514 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1515 |
} |
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1516 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1517 |
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
|
1518 |
{ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1519 |
/* Show the popup with option */ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1520 |
if (this->selected_item != 255) { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1521 |
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
|
1522 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1523 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1524 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1525 |
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
|
1526 |
{ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1527 |
/* -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
|
1528 |
if (pt.y == -1) { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1529 |
this->selected_y = 0; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1530 |
this->selected_item = 255; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1531 |
this->SetDirty(); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1532 |
return; |
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 |
/* 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
|
1535 |
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
|
1536 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1537 |
/* 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
|
1538 |
this->selected_y = pt.y; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1539 |
if (pt.y > CLNWND_OFFSET) { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1540 |
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
|
1541 |
} else { |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1542 |
this->selected_item = 255; |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1543 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1544 |
|
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1545 |
/* Repaint */ |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1546 |
this->SetDirty(); |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1547 |
} |
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1548 |
}; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1549 |
|
6573 | 1550 |
void ShowClientList() |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1551 |
{ |
10564
9d79c5088048
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
10563
diff
changeset
|
1552 |
AllocateWindowDescFront<NetworkClientListWindow>(&_client_list_desc, 0); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1553 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1554 |
|
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
|
1555 |
|
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 |
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
|
1557 |
|
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
|
1558 |
|
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
|
1559 |
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
|
1560 |
{ |
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
|
1561 |
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
|
1562 |
|
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
|
1563 |
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
|
1564 |
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
|
1565 |
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
|
1566 |
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
|
1567 |
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
|
1568 |
} |
5682
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5352
diff
changeset
|
1569 |
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
|
1570 |
} |
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
|
1571 |
|
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
|
1572 |
// 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
|
1573 |
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
|
1574 |
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
|
1575 |
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
|
1576 |
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
|
1577 |
|
10591
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1578 |
struct NetworkJoinStatusWindow : Window { |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1579 |
NetworkJoinStatusWindow(const WindowDesc *desc) : Window(desc) |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1580 |
{ |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1581 |
this->parent = FindWindowById(WC_NETWORK_WINDOW, 0); |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1582 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1583 |
|
10591
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1584 |
virtual void OnPaint() |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1585 |
{ |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1586 |
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
|
1587 |
this->DrawWidgets(); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1588 |
|
10591
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1589 |
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
|
1590 |
switch (_network_join_status) { |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1591 |
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
|
1592 |
case NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO: |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1593 |
progress = 10; // first two stages 10% |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1594 |
break; |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1595 |
case NETWORK_JOIN_STATUS_WAITING: |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1596 |
SetDParam(0, _network_join_waiting); |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1597 |
DrawStringCentered(125, 46, STR_NETWORK_CONNECTING_WAITING, TC_GREY); |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1598 |
progress = 15; // third stage is 15% |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1599 |
break; |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1600 |
case NETWORK_JOIN_STATUS_DOWNLOADING: |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1601 |
SetDParam(0, _network_join_kbytes); |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1602 |
SetDParam(1, _network_join_kbytes_total); |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1603 |
DrawStringCentered(125, 46, STR_NETWORK_CONNECTING_DOWNLOADING, TC_GREY); |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1604 |
/* Fallthrough */ |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1605 |
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
|
1606 |
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
|
1607 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1608 |
|
10591
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1609 |
/* Draw nice progress bar :) */ |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1610 |
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
|
1611 |
} |
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
|
1612 |
|
10591
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1613 |
virtual void OnClick(Point pt, int widget) |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1614 |
{ |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1615 |
if (widget == 2) { //Disconnect button |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1616 |
NetworkDisconnect(); |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1617 |
SwitchMode(SM_MENU); |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1618 |
ShowNetworkGameWindow(); |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1619 |
} |
0 | 1620 |
} |
10591
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1621 |
|
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1622 |
virtual void OnQueryTextFinished(char *str) |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1623 |
{ |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1624 |
if (StrEmpty(str)) { |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1625 |
NetworkDisconnect(); |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1626 |
ShowNetworkGameWindow(); |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1627 |
} else { |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1628 |
SEND_COMMAND(PACKET_CLIENT_PASSWORD)(pw_type, str); |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1629 |
} |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1630 |
} |
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1631 |
}; |
0 | 1632 |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1633 |
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
|
1634 |
{ 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
|
1635 |
{ 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
|
1636 |
{ 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
|
1637 |
{ WIDGETS_END}, |
0 | 1638 |
}; |
1639 |
||
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1640 |
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
|
1641 |
WDP_CENTER, WDP_CENTER, 250, 85, 250, 85, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5920
diff
changeset
|
1642 |
WC_NETWORK_STATUS_WINDOW, WC_NONE, |
5683
dca046ba7aa3
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5682
diff
changeset
|
1643 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_MODAL, |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1644 |
_network_join_status_window_widget, |
0 | 1645 |
}; |
1646 |
||
6573 | 1647 |
void ShowJoinStatusWindow() |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1648 |
{ |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
1649 |
DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0); |
10591
2b1df4c61347
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents:
10564
diff
changeset
|
1650 |
new NetworkJoinStatusWindow(&_network_join_status_window_desc); |
670
7c58dc46609c
(svn r1108) -Fix: [Network] Fixed problem around slow clients:
truelight
parents:
659
diff
changeset
|
1651 |
} |
0 | 1652 |
|
7027
f3d60745346d
(svn r9719) -Fix: in-game private messages did not work for clients with a Client ID > 255.
rubidium
parents:
6988
diff
changeset
|
1653 |
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
|
1654 |
{ |
7817
f24498d934ac
(svn r10684) -Codechange: some more coding style related changes. Primarily moving { to a new line.
rubidium
parents:
7717
diff
changeset
|
1655 |
if (StrEmpty(buf)) return; |
4013
a11adcc2a852
(svn r5226) Reduce the mess that sending chat messages is
tron
parents:
3860
diff
changeset
|
1656 |
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
|
1657 |
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
|
1658 |
} 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
|
1659 |
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
|
1660 |
} |
a11adcc2a852
(svn r5226) Reduce the mess that sending chat messages is
tron
parents:
3860
diff
changeset
|
1661 |
} |
a11adcc2a852
(svn r5226) Reduce the mess that sending chat messages is
tron
parents:
3860
diff
changeset
|
1662 |
|
4315
a0fc451fad6b
(svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents:
4300
diff
changeset
|
1663 |
|
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
|
1664 |
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
|
1665 |
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
|
1666 |
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
|
1667 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1668 |
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
|
1669 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
1671 |
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
|
1672 |
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
|
1673 |
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
|
1674 |
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
|
1675 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
1677 |
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
|
1678 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
_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
|
1680 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
this->FindWindowPlacementAndResize(desc); |
4315
a0fc451fad6b
(svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents:
4300
diff
changeset
|
1682 |
} |
a0fc451fad6b
(svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents:
4300
diff
changeset
|
1683 |
|
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
|
1684 |
~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
|
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 |
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
|
1687 |
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
|
1688 |
} |
4315
a0fc451fad6b
(svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents:
4300
diff
changeset
|
1689 |
|
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
|
1690 |
/** |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
* 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
|
1692 |
* @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
|
1693 |
* 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
|
1694 |
* @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
|
1695 |
*/ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
1697 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
1699 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1700 |
/* 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
|
1701 |
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
|
1702 |
/* 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
|
1703 |
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
|
1704 |
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
|
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 |
/* 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
|
1708 |
/* 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
|
1709 |
* 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
|
1710 |
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
|
1711 |
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
|
1712 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
1714 |
/* 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
|
1715 |
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
|
1716 |
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
|
1717 |
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
|
1718 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 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
|
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 |
* 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
|
1726 |
* 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
|
1727 |
* 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
|
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 *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
|
1730 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1731 |
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
|
1732 |
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
|
1733 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
*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
|
1735 |
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
|
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 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
* 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
|
1740 |
*/ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
1742 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1743 |
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
|
1744 |
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
|
1745 |
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
|
1746 |
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
|
1747 |
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
|
1748 |
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
|
1749 |
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
|
1750 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
1752 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1753 |
/* 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
|
1754 |
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
|
1755 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
1757 |
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
|
1758 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
1760 |
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
|
1761 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1762 |
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
|
1763 |
/* 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
|
1764 |
* 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
|
1765 |
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
|
1766 |
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
|
1767 |
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
|
1768 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
/* 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
|
1770 |
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
|
1771 |
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
|
1772 |
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
|
1773 |
} 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
|
1774 |
/* 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
|
1775 |
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
|
1776 |
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
|
1777 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
/* 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
|
1780 |
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
|
1781 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
1783 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
/* 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
|
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 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
1789 |
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
|
1790 |
/* 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
|
1791 |
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
|
1792 |
_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
|
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 |
/* 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
|
1795 |
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
|
1796 |
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
|
1797 |
} else { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1798 |
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
|
1799 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
1806 |
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
|
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 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
1811 |
/* 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
|
1812 |
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
|
1813 |
_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
|
1814 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
/* 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
|
1816 |
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
|
1817 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1818 |
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
|
1819 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
1821 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
1824 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1825 |
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
|
1826 |
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
|
1827 |
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
|
1828 |
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
|
1829 |
}; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
|
10595
7957c71b0dfe
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
10591
diff
changeset
|
1831 |
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
|
1832 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1833 |
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
|
1834 |
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
|
1835 |
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
|
1836 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1837 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 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
|
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 |
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
|
1841 |
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
|
1842 |
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
|
1843 |
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
|
1844 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1845 |
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
|
1846 |
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
|
1847 |
/* 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
|
1848 |
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
|
1849 |
} |
a0fc451fad6b
(svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents:
4300
diff
changeset
|
1850 |
} |
a0fc451fad6b
(svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents:
4300
diff
changeset
|
1851 |
|
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
|
1852 |
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
|
1853 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1854 |
this->HandleEditBox(2); |
4315
a0fc451fad6b
(svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents:
4300
diff
changeset
|
1855 |
} |
a0fc451fad6b
(svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents:
4300
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 |
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
|
1858 |
{ |
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
|
1859 |
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
|
1860 |
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
|
1861 |
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
|
1862 |
} 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
|
1863 |
_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
|
1864 |
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
|
1865 |
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
|
1866 |
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
|
1867 |
/* 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
|
1868 |
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
|
1869 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1870 |
} |
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
|
1871 |
return state; |
4315
a0fc451fad6b
(svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents:
4300
diff
changeset
|
1872 |
} |
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
|
1873 |
}; |
649 | 1874 |
|
1875 |
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
|
1876 |
{ 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
|
1877 |
{ 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
|
1878 |
{ 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
|
1879 |
{ WWT_PUSHTXTBTN, RESIZE_LR, 14, 258, 319, 1, 12, STR_NETWORK_SEND, STR_NULL}, // send button |
649 | 1880 |
{ WIDGETS_END}, |
1881 |
}; |
|
1882 |
||
1883 |
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
|
1884 |
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
|
1885 |
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
|
1886 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET, |
649 | 1887 |
_chat_window_widgets, |
1888 |
}; |
|
1889 |
||
7027
f3d60745346d
(svn r9719) -Fix: in-game private messages did not work for clients with a Client ID > 255.
rubidium
parents:
6988
diff
changeset
|
1890 |
void ShowNetworkChatQueryWindow(DestType type, int dest) |
649 | 1891 |
{ |
1892 |
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
|
1893 |
new NetworkChatWindow (&_chat_window_desc, type, dest); |
649 | 1894 |
} |
1895 |
||
8494
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1896 |
/** 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
|
1897 |
enum NetworkCompanyPasswordWindowWidgets { |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1898 |
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
|
1899 |
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
|
1900 |
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
|
1901 |
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
|
1902 |
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
|
1903 |
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
|
1904 |
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
|
1905 |
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
|
1906 |
}; |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1907 |
|
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 |
struct NetworkCompanyPasswordWindow : public QueryStringBaseWindow { |
10563
76819f7c2dc2
(svn r13107) -Codechange: make NetworkCompanyPasswordWindow and SelectPlayerFaceWindow children of PlayerCompanyWindow.
glx
parents:
10502
diff
changeset
|
1909 |
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
|
1910 |
{ |
10563
76819f7c2dc2
(svn r13107) -Codechange: make NetworkCompanyPasswordWindow and SelectPlayerFaceWindow children of PlayerCompanyWindow.
glx
parents:
10502
diff
changeset
|
1911 |
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
|
1912 |
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
|
1913 |
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
|
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 |
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
|
1916 |
} |
8494
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1917 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1918 |
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
|
1919 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
1921 |
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
|
1922 |
} |
8583
3c3f27c720d6
(svn r11648) -Fix [FS#1560]: the company password was not set when one pressed the enter key.
rubidium
parents:
8578
diff
changeset
|
1923 |
|
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
|
1924 |
/* 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
|
1925 |
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
|
1926 |
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
|
1927 |
NetworkChangeCompanyPassword(1, &password); |
8494
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1928 |
} |
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
|
1929 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
1931 |
{ |
10595
7957c71b0dfe
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
10591
diff
changeset
|
1932 |
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
|
1933 |
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
|
1934 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
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 |
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
|
1939 |
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
|
1940 |
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
|
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 |
/* 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
|
1943 |
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
|
1944 |
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
|
1945 |
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
|
1946 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
1948 |
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
|
1949 |
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
|
1950 |
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
|
1951 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1952 |
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
|
1953 |
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
|
1954 |
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
|
1955 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
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
|
1959 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1960 |
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
|
1961 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into 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 |
|
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
|
1963 |
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
|
1964 |
{ |
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
|
1965 |
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
|
1966 |
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
|
1967 |
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
|
1968 |
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
|
1969 |
/* 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
|
1970 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1971 |
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
|
1972 |
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
|
1973 |
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
|
1974 |
} |
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
|
1975 |
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
|
1976 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1977 |
}; |
8494
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1978 |
|
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1979 |
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
|
1980 |
{ 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
|
1981 |
{ 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
|
1982 |
{ 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
|
1983 |
{ 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
|
1984 |
{ 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
|
1985 |
{ 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
|
1986 |
{ 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
|
1987 |
{ 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
|
1988 |
{ WIDGETS_END}, |
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 |
|
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1991 |
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
|
1992 |
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
|
1993 |
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
|
1994 |
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
|
1995 |
_ncp_window_widgets, |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1996 |
}; |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
1997 |
|
10563
76819f7c2dc2
(svn r13107) -Codechange: make NetworkCompanyPasswordWindow and SelectPlayerFaceWindow children of PlayerCompanyWindow.
glx
parents:
10502
diff
changeset
|
1998 |
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
|
1999 |
{ |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
2000 |
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
|
2001 |
|
10563
76819f7c2dc2
(svn r13107) -Codechange: make NetworkCompanyPasswordWindow and SelectPlayerFaceWindow children of PlayerCompanyWindow.
glx
parents:
10502
diff
changeset
|
2002 |
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
|
2003 |
} |
88f26cafc858
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents:
8493
diff
changeset
|
2004 |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
2005 |
#endif /* ENABLE_NETWORK */ |