Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: parse the console settings the same way as config settings #9438

Merged
merged 1 commit into from Jul 11, 2021

Conversation

@rubidium42
Copy link
Contributor

@rubidium42 rubidium42 commented Jul 11, 2021

Motivation / Problem

set server_game_type in the in-game console shows the string representation (like local and public).
The configuration file uses local and public for the value of server_game_type.
But set server_game_type public cannot be done as public is not an integer.

Description

Use the parse logic from the settings instead of the integer parsing from the console to parse the setting. This way it gets unified.

Limitations

Technically there is a more useful error message that the parse function puts onto the error list. However, extracting that requires a lot of extra effort and adds a single translated string to the console output, whereas all other errors are not translated. So, I rather leave it with this simple error message.

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, gs_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')
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`.
@rubidium42 rubidium42 merged commit c71f06e into OpenTTD:master Jul 11, 2021
13 checks passed
Loading
@rubidium42 rubidium42 deleted the unified_setting_parse branch Jul 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants