mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-21 22:13:07 +01:00
1. Added --password=<str> to headless server mode to configure a password.
2. added default_password under [network] to configure a default password for headless server mode
This commit is contained in:
@@ -29,6 +29,7 @@ static bool _headless = false;
|
||||
#ifndef DISABLE_NETWORK
|
||||
static uint32 _port = 0;
|
||||
#endif
|
||||
static utf8 * _password = nullptr;
|
||||
static utf8 * _userDataPath = nullptr;
|
||||
static utf8 * _openrctDataPath = nullptr;
|
||||
|
||||
@@ -44,6 +45,7 @@ static const CommandLineOptionDefinition StandardOptions[]
|
||||
#ifndef DISABLE_NETWORK
|
||||
{ CMDLINE_TYPE_INTEGER, &_port, NAC, "port", "port to use for hosting or joining a server" },
|
||||
#endif
|
||||
{ CMDLINE_TYPE_STRING, &_password, NAC, "password", "password needed to join the server" },
|
||||
{ CMDLINE_TYPE_STRING, &_userDataPath, NAC, "user-data-path", "path to the user data directory (containing config.ini)" },
|
||||
{ CMDLINE_TYPE_STRING, &_openrctDataPath, NAC, "openrct-data-path", "path to the OpenRCT2 data directory (containing languages)" },
|
||||
OptionTableEnd
|
||||
@@ -135,6 +137,11 @@ exitcode_t CommandLine::HandleCommandDefault()
|
||||
Memory::Free(_openrctDataPath);
|
||||
}
|
||||
|
||||
if (_password != NULL) {
|
||||
String::Set(gCustomPassword, sizeof(gCustomPassword), _password);
|
||||
Memory::Free(_password);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -208,7 +215,7 @@ exitcode_t HandleCommandHost(CommandLineArgEnumerator * enumerator)
|
||||
gOpenRCT2StartupAction = STARTUP_ACTION_OPEN;
|
||||
String::Set(gOpenRCT2StartupActionPath, sizeof(gOpenRCT2StartupActionPath), parkUri);
|
||||
|
||||
gNetworkStart = NETWORK_MODE_SERVER;
|
||||
gNetworkStart = NETWORK_MODE_SERVER;
|
||||
gNetworkStartPort = _port;
|
||||
return EXITCODE_CONTINUE;
|
||||
}
|
||||
@@ -228,9 +235,9 @@ exitcode_t HandleCommandJoin(CommandLineArgEnumerator * enumerator)
|
||||
return EXITCODE_FAIL;
|
||||
}
|
||||
|
||||
gNetworkStart = NETWORK_MODE_CLIENT;
|
||||
gNetworkStart = NETWORK_MODE_CLIENT;
|
||||
gNetworkStartPort = _port;
|
||||
String::Set(gNetworkStartHost, sizeof(gNetworkStartHost), hostname);
|
||||
String::Set(gNetworkStartHost, sizeof(gNetworkStartHost), hostname);
|
||||
return EXITCODE_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user