Add: [Script] ScriptCargo::GetName, to get the human readable name of a cargo #8544
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 otherGetName()
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 NewGRF API? (label 'needs review: NewGRF')PR must be added to API tracker