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

Add: [Script] ScriptCargo::GetName, to get the human readable name of a cargo #8544

Merged
merged 1 commit into from Jan 9, 2021

Conversation

TrueBrain
Copy link
Member

Fixes #7869.

Motivation / Problem

Most other things have a GetName(), like Industries, even Roads. Cargo did not have it yet.

GetName() of course uses local language for the translation, this means that, like with all the other GetName() it should not be used to present strings to players. But it is very useful for debugging etc, and more consistent overall in the API.

Description

Of course this translates into AICargo.GetName() for AIs and
GSCargo.GetName() for GameScripts.

Limitations

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. ** Done **
    • The compatibility wrappers (compat_*.nut) need updating. ** Not needed, new addition **
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

@TrueBrain TrueBrain added this to the 1.11.0 milestone Jan 9, 2021
@TrueBrain TrueBrain added candidate: yes This Pull Request is a candidate for being merged needs review: Script API Review requested from GS/AI expert size: small This Pull Request is small, and should be relative easy to process labels Jan 9, 2021
@glx22
Copy link
Contributor

glx22 commented Jan 9, 2021

Maybe add a simple regression check

@SamuXarick
Copy link
Contributor

SamuXarick commented Jan 9, 2021

Unnamed, 1950-01-01#12

غير مسمى, 1950-01-01
It works!

… a cargo

Of course this translates into AICargo.GetName() for AIs and
GSCargo.GetName() for GameScripts.
@TrueBrain TrueBrain merged commit 218f40e into OpenTTD:master Jan 9, 2021
@TrueBrain TrueBrain deleted the script_cargo_name branch January 9, 2021 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
candidate: yes This Pull Request is a candidate for being merged needs review: Script API Review requested from GS/AI expert size: small This Pull Request is small, and should be relative easy to process
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The human-readable name of a cargo type can't be queried by AI/GS.
3 participants