mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: move hostnames in settings to std::string
This commit is contained in:
parent
c73d64adf9
commit
cc6c078dec
|
@ -893,13 +893,13 @@ DEF_CONSOLE_CMD(ConNetworkReconnect)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrEmpty(_settings_client.network.last_joined)) {
|
if (_settings_client.network.last_joined.empty()) {
|
||||||
IConsolePrint(CC_DEFAULT, "No server for reconnecting.");
|
IConsolePrint(CC_DEFAULT, "No server for reconnecting.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't resolve the address first, just print it directly as it comes from the config file. */
|
/* Don't resolve the address first, just print it directly as it comes from the config file. */
|
||||||
IConsolePrintF(CC_DEFAULT, "Reconnecting to %s ...", _settings_client.network.last_joined);
|
IConsolePrintF(CC_DEFAULT, "Reconnecting to %s ...", _settings_client.network.last_joined.c_str());
|
||||||
|
|
||||||
return NetworkClientConnectGame(_settings_client.network.last_joined, playas);
|
return NetworkClientConnectGame(_settings_client.network.last_joined, playas);
|
||||||
}
|
}
|
||||||
|
|
|
@ -824,7 +824,7 @@ void NetworkClientJoinGame()
|
||||||
NetworkDisconnect();
|
NetworkDisconnect();
|
||||||
NetworkInitialize();
|
NetworkInitialize();
|
||||||
|
|
||||||
strecpy(_settings_client.network.last_joined, _network_join.connection_string.c_str(), lastof(_settings_client.network.last_joined));
|
_settings_client.network.last_joined = _network_join.connection_string;
|
||||||
_network_join_status = NETWORK_JOIN_STATUS_CONNECTING;
|
_network_join_status = NETWORK_JOIN_STATUS_CONNECTING;
|
||||||
ShowJoinStatusWindow();
|
ShowJoinStatusWindow();
|
||||||
|
|
||||||
|
|
|
@ -828,7 +828,7 @@ public:
|
||||||
void OnQueryTextFinished(char *str) override
|
void OnQueryTextFinished(char *str) override
|
||||||
{
|
{
|
||||||
if (!StrEmpty(str)) {
|
if (!StrEmpty(str)) {
|
||||||
strecpy(_settings_client.network.connect_to_ip, str, lastof(_settings_client.network.connect_to_ip));
|
_settings_client.network.connect_to_ip = str;
|
||||||
NetworkAddServer(str);
|
NetworkAddServer(str);
|
||||||
NetworkRebuildHostList();
|
NetworkRebuildHostList();
|
||||||
}
|
}
|
||||||
|
@ -1556,7 +1556,7 @@ static void ShowNetworkLobbyWindow(NetworkGameList *ngl)
|
||||||
DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_START);
|
DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_START);
|
||||||
DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
|
DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
|
||||||
|
|
||||||
strecpy(_settings_client.network.last_joined, ngl->connection_string.c_str(), lastof(_settings_client.network.last_joined));
|
_settings_client.network.last_joined = ngl->connection_string;
|
||||||
|
|
||||||
NetworkQueryLobbyServer(ngl->connection_string);
|
NetworkQueryLobbyServer(ngl->connection_string);
|
||||||
|
|
||||||
|
|
|
@ -269,7 +269,7 @@ struct NetworkSettings {
|
||||||
bool server_advertise; ///< advertise the server to the masterserver
|
bool server_advertise; ///< advertise the server to the masterserver
|
||||||
char client_name[NETWORK_CLIENT_NAME_LENGTH]; ///< name of the player (as client)
|
char client_name[NETWORK_CLIENT_NAME_LENGTH]; ///< name of the player (as client)
|
||||||
std::string default_company_pass; ///< default password for new companies in encrypted form
|
std::string default_company_pass; ///< default password for new companies in encrypted form
|
||||||
char connect_to_ip[NETWORK_HOSTNAME_PORT_LENGTH]; ///< default for the "Add server" query
|
std::string connect_to_ip; ///< default for the "Add server" query
|
||||||
char network_id[NETWORK_SERVER_ID_LENGTH]; ///< network ID for servers
|
char network_id[NETWORK_SERVER_ID_LENGTH]; ///< network ID for servers
|
||||||
bool autoclean_companies; ///< automatically remove companies that are not in use
|
bool autoclean_companies; ///< automatically remove companies that are not in use
|
||||||
uint8 autoclean_unprotected; ///< remove passwordless companies after this many months
|
uint8 autoclean_unprotected; ///< remove passwordless companies after this many months
|
||||||
|
@ -281,7 +281,7 @@ struct NetworkSettings {
|
||||||
Year restart_game_year; ///< year the server restarts
|
Year restart_game_year; ///< year the server restarts
|
||||||
uint8 min_active_clients; ///< minimum amount of active clients to unpause the game
|
uint8 min_active_clients; ///< minimum amount of active clients to unpause the game
|
||||||
bool reload_cfg; ///< reload the config file before restarting
|
bool reload_cfg; ///< reload the config file before restarting
|
||||||
char last_joined[NETWORK_HOSTNAME_PORT_LENGTH]; ///< Last joined server
|
std::string last_joined; ///< Last joined server
|
||||||
bool no_http_content_downloads; ///< do not do content downloads over HTTP
|
bool no_http_content_downloads; ///< do not do content downloads over HTTP
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3970,9 +3970,10 @@ def = nullptr
|
||||||
proc = UpdateClientConfigValues
|
proc = UpdateClientConfigValues
|
||||||
cat = SC_BASIC
|
cat = SC_BASIC
|
||||||
|
|
||||||
[SDTC_STR]
|
[SDTC_SSTR]
|
||||||
var = network.connect_to_ip
|
var = network.connect_to_ip
|
||||||
type = SLE_STRB
|
type = SLE_STR
|
||||||
|
length = 0
|
||||||
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
|
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
|
||||||
def = nullptr
|
def = nullptr
|
||||||
|
|
||||||
|
@ -4075,9 +4076,10 @@ guiflags = SGF_NETWORK_ONLY
|
||||||
def = false
|
def = false
|
||||||
cat = SC_EXPERT
|
cat = SC_EXPERT
|
||||||
|
|
||||||
[SDTC_STR]
|
[SDTC_SSTR]
|
||||||
var = network.last_joined
|
var = network.last_joined
|
||||||
type = SLE_STRB
|
type = SLE_STR
|
||||||
|
length = 0
|
||||||
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
|
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
|
||||||
def = """"
|
def = """"
|
||||||
cat = SC_EXPERT
|
cat = SC_EXPERT
|
||||||
|
|
Loading…
Reference in New Issue