mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 15:41:15 +00:00
Currently it says "the server" which is a bit ambigious. Be more specific.
This commit is contained in:
parent
996ae28989
commit
c4b700f1b0
@ -2163,7 +2163,7 @@ STR_NETWORK_CLIENT_LIST_ASK_COMPANY_RESET :{YELLOW}Are you
|
||||
STR_NETWORK_CLIENT_LIST_ASK_COMPANY_UNLOCK :{YELLOW}Are you sure you want to reset the password of company '{COMPANY}'?
|
||||
|
||||
STR_NETWORK_ASK_RELAY_CAPTION :{WHITE}Use relay?
|
||||
STR_NETWORK_ASK_RELAY_TEXT :{YELLOW}Failed to establish a connection between you and the server.{}Would you like to relay this session via '{RAW_STRING}'?
|
||||
STR_NETWORK_ASK_RELAY_TEXT :{YELLOW}Failed to establish a connection between you and server '{RAW_STRING}'.{}Would you like to relay this session via '{RAW_STRING}'?
|
||||
STR_NETWORK_ASK_RELAY_NO :{BLACK}No
|
||||
STR_NETWORK_ASK_RELAY_YES_ONCE :{BLACK}Yes, this once
|
||||
STR_NETWORK_ASK_RELAY_YES_ALWAYS :{BLACK}Yes, don't ask again
|
||||
|
@ -279,7 +279,7 @@ bool ClientNetworkCoordinatorSocketHandler::Receive_GC_CONNECTING(Packet *p)
|
||||
}
|
||||
|
||||
/* Now store it based on the token. */
|
||||
this->connecter[token] = connecter_pre_it->second;
|
||||
this->connecter[token] = {invite_code, connecter_pre_it->second};
|
||||
this->connecter_pre.erase(connecter_pre_it);
|
||||
|
||||
return true;
|
||||
@ -378,16 +378,24 @@ bool ClientNetworkCoordinatorSocketHandler::Receive_GC_TURN_CONNECT(Packet *p)
|
||||
this->game_connecter = nullptr;
|
||||
}
|
||||
|
||||
Debug(misc, 0, "{}", ticket);
|
||||
this->turn_handlers[token] = ClientNetworkTurnSocketHandler::Turn(token, tracking_number, ticket, connection_string);
|
||||
|
||||
if (!_network_server) {
|
||||
auto connecter_it = this->connecter.find(token);
|
||||
if (connecter_it == this->connecter.end()) {
|
||||
/* Make sure we are still interested in connecting to this server. */
|
||||
this->ConnectFailure(token, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (_settings_client.network.use_relay_service) {
|
||||
case URS_NEVER:
|
||||
this->ConnectFailure(token, 0);
|
||||
break;
|
||||
|
||||
case URS_ASK:
|
||||
ShowNetworkAskRelay(connection_string, token);
|
||||
ShowNetworkAskRelay(connecter_it->second.first, connection_string, token);
|
||||
break;
|
||||
|
||||
case URS_ALLOW:
|
||||
@ -579,7 +587,7 @@ void ClientNetworkCoordinatorSocketHandler::ConnectSuccess(const std::string &to
|
||||
* processes of connecting us. */
|
||||
auto connecter_it = this->connecter.find(token);
|
||||
if (connecter_it != this->connecter.end()) {
|
||||
connecter_it->second->SetConnected(sock);
|
||||
connecter_it->second.second->SetConnected(sock);
|
||||
this->connecter.erase(connecter_it);
|
||||
}
|
||||
}
|
||||
@ -665,7 +673,7 @@ void ClientNetworkCoordinatorSocketHandler::CloseToken(const std::string &token)
|
||||
/* Close the caller of the connection attempt. */
|
||||
auto connecter_it = this->connecter.find(token);
|
||||
if (connecter_it != this->connecter.end()) {
|
||||
connecter_it->second->SetFailure();
|
||||
connecter_it->second.second->SetFailure();
|
||||
this->connecter.erase(connecter_it);
|
||||
}
|
||||
}
|
||||
@ -685,7 +693,7 @@ void ClientNetworkCoordinatorSocketHandler::CloseAllConnections()
|
||||
for (auto &[token, it] : this->connecter) {
|
||||
this->CloseStunHandler(token);
|
||||
this->CloseTurnHandler(token);
|
||||
it->SetFailure();
|
||||
it.second->SetFailure();
|
||||
|
||||
/* Inform the Game Coordinator he can stop trying to connect us to the server. */
|
||||
this->ConnectFailure(token, 0);
|
||||
|
@ -54,7 +54,7 @@
|
||||
class ClientNetworkCoordinatorSocketHandler : public NetworkCoordinatorSocketHandler {
|
||||
private:
|
||||
std::chrono::steady_clock::time_point next_update; ///< When to send the next update (if server and public).
|
||||
std::map<std::string, TCPServerConnecter *> connecter; ///< Based on tokens, the current connecters that are pending.
|
||||
std::map<std::string, std::pair<std::string, TCPServerConnecter *>> connecter; ///< Based on tokens, the current (invite-code, connecter) that are pending.
|
||||
std::map<std::string, TCPServerConnecter *> connecter_pre; ///< Based on invite codes, the current connecters that are pending.
|
||||
std::map<std::string, std::map<int, std::unique_ptr<ClientNetworkStunSocketHandler>>> stun_handlers; ///< All pending STUN handlers, stored by token:family.
|
||||
std::map<std::string, std::unique_ptr<ClientNetworkTurnSocketHandler>> turn_handlers; ///< Pending TURN handler (if any), stored by token.
|
||||
|
@ -2361,13 +2361,18 @@ void ShowNetworkCompanyPasswordWindow(Window *parent)
|
||||
}
|
||||
|
||||
/**
|
||||
* Window used for asking the user if he is okay using a TURN server.
|
||||
* Window used for asking the user if he is okay using a relay server.
|
||||
*/
|
||||
struct NetworkAskRelayWindow : public Window {
|
||||
std::string connection_string; ///< The TURN server we want to connect to.
|
||||
std::string server_connection_string; ///< The game server we want to connect to.
|
||||
std::string relay_connection_string; ///< The relay server we want to connect to.
|
||||
std::string token; ///< The token for this connection.
|
||||
|
||||
NetworkAskRelayWindow(WindowDesc *desc, Window *parent, const std::string &connection_string, const std::string &token) : Window(desc), connection_string(connection_string), token(token)
|
||||
NetworkAskRelayWindow(WindowDesc *desc, Window *parent, const std::string &server_connection_string, const std::string &relay_connection_string, const std::string &token) :
|
||||
Window(desc),
|
||||
server_connection_string(server_connection_string),
|
||||
relay_connection_string(relay_connection_string),
|
||||
token(token)
|
||||
{
|
||||
this->parent = parent;
|
||||
this->InitNested(0);
|
||||
@ -2400,7 +2405,8 @@ struct NetworkAskRelayWindow : public Window {
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_NAR_TEXT:
|
||||
SetDParamStr(0, this->connection_string);
|
||||
SetDParamStr(0, this->server_connection_string);
|
||||
SetDParamStr(1, this->relay_connection_string);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2451,13 +2457,14 @@ static WindowDesc _network_ask_relay_desc(
|
||||
|
||||
/**
|
||||
* Show a modal confirmation window with "no" / "yes, once" / "yes, always" buttons.
|
||||
* @param connection_string The relay server we want to connect to.
|
||||
* @param server_connection_string The game server we want to connect to.
|
||||
* @param relay_connection_string The relay server we want to connect to.
|
||||
* @param token The token for this connection.
|
||||
*/
|
||||
void ShowNetworkAskRelay(const std::string &connection_string, const std::string &token)
|
||||
void ShowNetworkAskRelay(const std::string &server_connection_string, const std::string &relay_connection_string, const std::string &token)
|
||||
{
|
||||
CloseWindowByClass(WC_NETWORK_ASK_RELAY);
|
||||
|
||||
Window *parent = FindWindowById(WC_MAIN_WINDOW, 0);
|
||||
new NetworkAskRelayWindow(&_network_ask_relay_desc, parent, connection_string, token);
|
||||
new NetworkAskRelayWindow(&_network_ask_relay_desc, parent, server_connection_string, relay_connection_string, token);
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ void ShowJoinStatusWindow();
|
||||
void ShowNetworkGameWindow();
|
||||
void ShowClientList();
|
||||
void ShowNetworkCompanyPasswordWindow(Window *parent);
|
||||
void ShowNetworkAskRelay(const std::string &server_connection_string, const std::string &relay_connection_string, const std::string &token);
|
||||
|
||||
|
||||
/** Company information stored at the client side */
|
||||
@ -37,6 +38,5 @@ struct NetworkCompanyInfo : NetworkCompanyStats {
|
||||
std::string clients; ///< The clients that control this company (Name1, name2, ..)
|
||||
};
|
||||
|
||||
void ShowNetworkAskRelay(const std::string &connection_string, const std::string &token);
|
||||
|
||||
#endif /* NETWORK_GUI_H */
|
||||
|
Loading…
Reference in New Issue
Block a user