Changeset - r25462:cf7a0a10bcaa
[Not reviewed]
master
0 5 0
rubidium42 - 4 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
 
@@ -890,19 +890,19 @@ DEF_CONSOLE_CMD(ConNetworkReconnect)
 
			/* From a user pov 0 is a new company, internally it's different and all
 
			 * companies are offset by one to ease up on users (eg companies 1-8 not 0-7) */
 
			if (playas < COMPANY_FIRST + 1 || playas > MAX_COMPANIES + 1) return false;
 
			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);
 
}
 

	
 
DEF_CONSOLE_CMD(ConNetworkConnect)
 
{
src/network/network.cpp
Show inline comments
 
@@ -821,13 +821,13 @@ bool NetworkClientConnectGame(const std:
 
 */
 
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();
 

	
 
	new TCPClientConnecter(_network_join.connection_string);
 
}
 

	
src/network/network_gui.cpp
Show inline comments
 
@@ -825,13 +825,13 @@ 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();
 
		}
 
	}
 

	
 
	void OnResize() override
 
@@ -1553,13 +1553,13 @@ static void ShowNetworkLobbyWindow(Netwo
 
{
 
	if (!NetworkValidateClientName()) return;
 

	
 
	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);
 

	
 
	new NetworkLobbyWindow(&_network_lobby_window_desc, ngl);
 
}
 

	
src/settings_type.h
Show inline comments
 
@@ -266,25 +266,25 @@ struct NetworkSettings {
 
	std::string server_password;                          ///< password for joining this server
 
	std::string rcon_password;                            ///< password for rconsole (server side)
 
	std::string admin_password;                           ///< password for the admin network
 
	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
 
	uint8  autoclean_protected;                           ///< remove the password from passworded companies after this many months
 
	uint8  autoclean_novehicles;                          ///< remove companies with no vehicles after this many months
 
	uint8  max_companies;                                 ///< maximum amount of companies
 
	uint8  max_clients;                                   ///< maximum amount of clients
 
	uint8  max_spectators;                                ///< maximum amount of spectators
 
	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
 
};
 

	
 
/** Settings related to the creation of games. */
 
struct GameCreationSettings {
 
	uint32 generation_seed;                  ///< noise seed for world generation
src/table/settings.ini
Show inline comments
 
@@ -3967,15 +3967,16 @@ type     = SLE_STRB
 
flags    = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
 
guiflags = SGF_NETWORK_ONLY
 
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
 

	
 
[SDTC_STR]
 
var      = network.network_id
 
type     = SLE_STRB
 
@@ -4072,15 +4073,16 @@ max      = MAX_CLIENTS
 
var      = network.reload_cfg
 
flags    = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
 
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
 

	
 
[SDTC_BOOL]
 
var      = network.no_http_content_downloads
0 comments (0 inline, 0 general)