mirror of https://github.com/OpenTTD/OpenTTD.git
Feature: parse the console settings the same way as config settings
Now you can use things like `set server_game_type public` instead of having to guess the number, which would not be written into the configuration file nor would it be shown when doing `set server_game_type`.
This commit is contained in:
parent
dd7f69be6e
commit
c71f06e59b
|
@ -117,7 +117,7 @@ Last updated: 2011-02-16
|
||||||
- If you want to be on the server-list, make your server public. You can do
|
- If you want to be on the server-list, make your server public. You can do
|
||||||
this either from the Start Server GUI, via the in-game Online Players GUI,
|
this either from the Start Server GUI, via the in-game Online Players GUI,
|
||||||
or by typing in the console:
|
or by typing in the console:
|
||||||
'set server_game_type 1'.
|
'set server_game_type public'.
|
||||||
|
|
||||||
- You can protect your server with a password via the console: 'set server_pw',
|
- You can protect your server with a password via the console: 'set server_pw',
|
||||||
or via the Start Server menu.
|
or via the Start Server menu.
|
||||||
|
|
|
@ -1635,15 +1635,14 @@ void IConsoleSetSetting(const char *name, const char *value, bool force_newgame)
|
||||||
if (sd->IsStringSetting()) {
|
if (sd->IsStringSetting()) {
|
||||||
success = SetSettingValue(sd->AsStringSetting(), value, force_newgame);
|
success = SetSettingValue(sd->AsStringSetting(), value, force_newgame);
|
||||||
} else if (sd->IsIntSetting()) {
|
} else if (sd->IsIntSetting()) {
|
||||||
uint32 val;
|
const IntSettingDesc *isd = sd->AsIntSetting();
|
||||||
extern bool GetArgumentInteger(uint32 *value, const char *arg);
|
size_t val = isd->ParseValue(value);
|
||||||
success = GetArgumentInteger(&val, value);
|
if (!_settings_error_list.empty()) {
|
||||||
if (!success) {
|
IConsolePrint(CC_ERROR, "'{}' is not a valid value for this setting.", value);
|
||||||
IConsolePrint(CC_ERROR, "'{}' is not an integer.", value);
|
_settings_error_list.clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
success = SetSettingValue(isd, (int32)val, force_newgame);
|
||||||
success = SetSettingValue(sd->AsIntSetting(), val, force_newgame);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
|
|
Loading…
Reference in New Issue