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

@TrueBrain TrueBrain commented Jan 9, 2021

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 needs review: Script API size: small labels Jan 9, 2021
@glx22
Copy link
Contributor

@glx22 glx22 commented Jan 9, 2021

Maybe add a simple regression check

@SamuXarick
Copy link
Contributor

@SamuXarick SamuXarick commented Jan 9, 2021

Unnamed, 1950-01-01#12

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

regression/regression/main.nut Outdated Show resolved Hide resolved
… a cargo

Of course this translates into AICargo.GetName() for AIs and
GSCargo.GetName() for GameScripts.
glx22
glx22 approved these changes Jan 9, 2021
@TrueBrain TrueBrain merged commit 218f40e into OpenTTD:master Jan 9, 2021
8 checks passed
@TrueBrain TrueBrain deleted the script_cargo_name branch Jan 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
candidate: yes needs review: Script API size: small
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants