diff options
-rw-r--r-- | src/newgrf_text.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp index 2c9fe6579..df00ef341 100644 --- a/src/newgrf_text.cpp +++ b/src/newgrf_text.cpp @@ -1062,9 +1062,11 @@ uint RemapNewGRFStringControlCode(uint scc, char *buf_start, char **buff, const *argv = MapGRFStringID(_newgrf_textrefstack.grffile->grfid, _newgrf_textrefstack.PopUnsignedWord()); break; - case SCC_NEWGRF_PRINT_WORD_CARGO_NAME: - *argv = 1 << GetCargoTranslation(_newgrf_textrefstack.PopUnsignedWord(), _newgrf_textrefstack.grffile); + case SCC_NEWGRF_PRINT_WORD_CARGO_NAME: { + CargoID cargo = GetCargoTranslation(_newgrf_textrefstack.PopUnsignedWord(), _newgrf_textrefstack.grffile); + *argv = cargo < NUM_CARGO ? 1 << cargo : 0; break; + } } } else { /* Consume additional parameter characters */ |