(svn r27707) -Fix: Make the result of NewGRF's CARGO_NAME string code reliably print 'Nothing', if an invalid type is provided.

This commit is contained in:
frosch 2016-12-23 22:13:38 +00:00
parent b25afb239a
commit 1a92b0c7c3
1 changed files with 4 additions and 2 deletions

View File

@ -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 */