OpenTTD Source
12.0-beta2
|
#include "../stdafx.h"
#include "../strings_func.h"
#include "../date_func.h"
#include "../fios.h"
#include "network_client.h"
#include "network_gui.h"
#include "network_gamelist.h"
#include "network.h"
#include "network_base.h"
#include "network_content.h"
#include "network_server.h"
#include "network_coordinator.h"
#include "../gui.h"
#include "network_udp.h"
#include "../window_func.h"
#include "../gfx_func.h"
#include "../widgets/dropdown_type.h"
#include "../widgets/dropdown_func.h"
#include "../querystring_gui.h"
#include "../sortlist_type.h"
#include "../company_func.h"
#include "../command_func.h"
#include "../core/geometry_func.hpp"
#include "../genworld.h"
#include "../map_type.h"
#include "../guitimer_func.h"
#include "../zoom_func.h"
#include "../sprite.h"
#include "../settings_internal.h"
#include "../widgets/network_widget.h"
#include "table/strings.h"
#include "../table/sprites.h"
#include "../stringfilter_type.h"
#include <map>
#include "../safeguards.h"
Go to the source code of this file.
Data Structures | |
class | NWidgetServerListHeader |
Full blown container to make it behave exactly as we want :) More... | |
class | NetworkGameWindow |
struct | NetworkStartServerWindow |
class | ButtonCommon |
Button shown for either a company or client in the client-list. More... | |
class | Button< T > |
Template version of Button, with callback support. More... | |
struct | NetworkClientListWindow |
Main handle for clientlist. More... | |
struct | NetworkJoinStatusWindow |
struct | NetworkCompanyPasswordWindow |
struct | NetworkAskRelayWindow |
Window used for asking the user if he is okay using a relay server. More... | |
Typedefs | |
typedef GUIList< NetworkGameList *, StringFilter & > | GUIGameServerList |
typedef int | ServerListPosition |
using | CompanyButton = Button< CompanyID > |
using | ClientButton = Button< ClientID > |
Enumerations | |
enum | DropDownAdmin { DD_CLIENT_ADMIN_KICK, DD_CLIENT_ADMIN_BAN, DD_COMPANY_ADMIN_RESET, DD_COMPANY_ADMIN_UNLOCK } |
The possibly entries in a DropDown for an admin. More... | |
Functions | |
static void | ShowNetworkStartServerWindow () |
void | UpdateNetworkGameWindow () |
Update the network new window because a new server is found on the network. | |
static DropDownList | BuildVisibilityDropDownList () |
static NWidgetBase * | MakeResizableHeader (int *biggest_index) |
void | ShowNetworkGameWindow () |
void | DrawCompanyIcon (CompanyID cid, int x, int y) |
Draw the icon of a company. More... | |
static void | AdminClientKickCallback (Window *w, bool confirmed) |
Callback function for admin command to kick client. More... | |
static void | AdminClientBanCallback (Window *w, bool confirmed) |
Callback function for admin command to ban client. More... | |
static void | AdminCompanyResetCallback (Window *w, bool confirmed) |
Callback function for admin command to reset company. More... | |
static void | AdminCompanyUnlockCallback (Window *w, bool confirmed) |
Callback function for admin command to unlock company. More... | |
void | ShowClientList () |
void | ShowJoinStatusWindow () |
void | ShowNetworkNeedPassword (NetworkPasswordType npt) |
void | ShowNetworkCompanyPasswordWindow (Window *parent) |
void | ShowNetworkAskRelay (const std::string &server_connection_string, const std::string &relay_connection_string, const std::string &token) |
Show a modal confirmation window with "no" / "yes, once" / "yes, always" buttons. More... | |
Variables | |
static const int | NETWORK_LIST_REFRESH_DELAY = 30 |
Time, in seconds, between updates of the network list. | |
static ClientID | _admin_client_id = INVALID_CLIENT_ID |
For what client a confirmation window is open. | |
static CompanyID | _admin_company_id = INVALID_COMPANY |
For what company a confirmation window is open. | |
static const ServerListPosition | SLP_INVALID = -1 |
static const NWidgetPart | _nested_network_game_widgets [] |
static WindowDesc | _network_game_window_desc (WDP_CENTER, "list_servers", 1000, 730, WC_NETWORK_WINDOW, WC_NONE, 0, _nested_network_game_widgets, lengthof(_nested_network_game_widgets)) |
static const NWidgetPart | _nested_network_start_server_window_widgets [] |
static WindowDesc | _network_start_server_window_desc (WDP_CENTER, nullptr, 0, 0, WC_NETWORK_WINDOW, WC_NONE, 0, _nested_network_start_server_window_widgets, lengthof(_nested_network_start_server_window_widgets)) |
static const NWidgetPart | _nested_client_list_widgets [] |
static WindowDesc | _client_list_desc (WDP_AUTO, "list_clients", 220, 300, WC_CLIENT_LIST, WC_NONE, 0, _nested_client_list_widgets, lengthof(_nested_client_list_widgets)) |
NetworkJoinStatus | _network_join_status |
The status of joining. | |
uint8 | _network_join_waiting |
The number of clients waiting in front of us. | |
uint32 | _network_join_bytes |
The number of bytes we already downloaded. | |
uint32 | _network_join_bytes_total |
The total number of bytes to download. | |
static const NWidgetPart | _nested_network_join_status_window_widgets [] |
static WindowDesc | _network_join_status_window_desc (WDP_CENTER, nullptr, 0, 0, WC_NETWORK_STATUS_WINDOW, WC_NONE, WDF_MODAL, _nested_network_join_status_window_widgets, lengthof(_nested_network_join_status_window_widgets)) |
static const NWidgetPart | _nested_network_company_password_window_widgets [] |
static WindowDesc | _network_company_password_window_desc (WDP_AUTO, nullptr, 0, 0, WC_COMPANY_PASSWORD_WINDOW, WC_NONE, 0, _nested_network_company_password_window_widgets, lengthof(_nested_network_company_password_window_widgets)) |
static const NWidgetPart | _nested_network_ask_relay_widgets [] |
static WindowDesc | _network_ask_relay_desc (WDP_CENTER, nullptr, 0, 0, WC_NETWORK_ASK_RELAY, WC_NONE, WDF_MODAL, _nested_network_ask_relay_widgets, lengthof(_nested_network_ask_relay_widgets)) |
Implementation of the Network related GUIs.
Definition in file network_gui.cpp.
enum DropDownAdmin |
The possibly entries in a DropDown for an admin.
Client and companies are mixed; they just have to be unique.
Definition at line 1343 of file network_gui.cpp.
|
static |
Callback function for admin command to ban client.
w | The window which initiated the confirmation dialog. |
confirmed | Iff the user pressed Yes. |
Definition at line 1365 of file network_gui.cpp.
References _admin_client_id, and NetworkServerKickOrBanIP().
|
static |
Callback function for admin command to kick client.
w | The window which initiated the confirmation dialog. |
confirmed | Iff the user pressed Yes. |
Definition at line 1355 of file network_gui.cpp.
References _admin_client_id, and NetworkServerKickClient().
|
static |
Callback function for admin command to reset company.
w | The window which initiated the confirmation dialog. |
confirmed | Iff the user pressed Yes. |
Definition at line 1375 of file network_gui.cpp.
References _admin_company_id, CCA_DELETE, CMD_COMPANY_CTRL, CRR_MANUAL, DoCommandP(), and NetworkCompanyHasClients().
|
static |
Callback function for admin command to unlock company.
w | The window which initiated the confirmation dialog. |
confirmed | Iff the user pressed Yes. |
Definition at line 1388 of file network_gui.cpp.
References _admin_company_id, and NetworkServerSetCompanyPassword().
void DrawCompanyIcon | ( | CompanyID | c, |
int | x, | ||
int | y | ||
) |
Draw the icon of a company.
c | Company that needs its icon drawn. |
x | Horizontal coordinate of the icon. |
y | Vertical coordinate of the icon. |
Definition at line 143 of file company_cmd.cpp.
Referenced by AIDebugWindow::OnPaint().
void ShowNetworkAskRelay | ( | const std::string & | server_connection_string, |
const std::string & | relay_connection_string, | ||
const std::string & | token | ||
) |
Show a modal confirmation window with "no" / "yes, once" / "yes, always" buttons.
server_connection_string | The game server we want to connect to. |
relay_connection_string | The relay server we want to connect to. |
token | The token for this connection. |
Definition at line 2464 of file network_gui.cpp.
References CloseWindowByClass(), FindWindowById(), WC_MAIN_WINDOW, and WC_NETWORK_ASK_RELAY.
|
static |
Definition at line 2436 of file network_gui.cpp.
|
static |
Definition at line 2324 of file network_gui.cpp.
|
static |
Definition at line 2213 of file network_gui.cpp.