Changeset - r25462:cf7a0a10bcaa
[Not reviewed]
master
0 5 0
rubidium42 - 3 years ago 2021-04-27 19:10:11
rubidium@openttd.org
Codechange: move hostnames in settings to std::string
5 files changed with 13 insertions and 11 deletions:
0 comments (0 inline, 0 general)
src/console_cmds.cpp
Show inline comments
 
@@ -893,13 +893,13 @@ DEF_CONSOLE_CMD(ConNetworkReconnect)
 
			break;
 
	}
 

	
 
	if (StrEmpty(_settings_client.network.last_joined)) {
 
	if (_settings_client.network.last_joined.empty()) {
 
		IConsolePrint(CC_DEFAULT, "No server for reconnecting.");
 
		return true;
 
	}
 

	
 
	/* 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);
 
}
src/network/network.cpp
Show inline comments
 
@@ -824,7 +824,7 @@ void NetworkClientJoinGame()
 
	NetworkDisconnect();
 
	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;
 
	ShowJoinStatusWindow();
 

	
src/network/network_gui.cpp
Show inline comments
 
@@ -828,7 +828,7 @@ public:
 
	void OnQueryTextFinished(char *str) override
 
	{
 
		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);
 
			NetworkRebuildHostList();
 
		}
 
@@ -1556,7 +1556,7 @@ static void ShowNetworkLobbyWindow(Netwo
 
	DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_START);
 
	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);
 

	
src/settings_type.h
Show inline comments
 
@@ -269,7 +269,7 @@ struct NetworkSettings {
 
	bool   server_advertise;                              ///< advertise the server to the masterserver
 
	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
 
	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
 
	bool   autoclean_companies;                           ///< automatically remove companies that are not in use
 
	uint8  autoclean_unprotected;                         ///< remove passwordless companies after this many months
 
@@ -281,7 +281,7 @@ struct NetworkSettings {
 
	Year   restart_game_year;                             ///< year the server restarts
 
	uint8  min_active_clients;                            ///< minimum amount of active clients to unpause the game
 
	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
 
};
 

	
src/table/settings.ini
Show inline comments
 
@@ -3970,9 +3970,10 @@ def      = nullptr
 
proc     = UpdateClientConfigValues
 
cat      = SC_BASIC
 

	
 
[SDTC_STR]
 
[SDTC_SSTR]
 
var      = network.connect_to_ip
 
type     = SLE_STRB
 
type     = SLE_STR
 
length   = 0
 
flags    = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
 
def      = nullptr
 

	
 
@@ -4075,9 +4076,10 @@ guiflags = SGF_NETWORK_ONLY
 
def      = false
 
cat      = SC_EXPERT
 

	
 
[SDTC_STR]
 
[SDTC_SSTR]
 
var      = network.last_joined
 
type     = SLE_STRB
 
type     = SLE_STR
 
length   = 0
 
flags    = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
 
def      = """"
 
cat      = SC_EXPERT
0 comments (0 inline, 0 general)