mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-06-26 06:59:56 +01:00
(svn r27706) -Feature: [NewGRF] String command 9A 1E to print the name of a cargo type.
This commit is contained in:
parent
2c8b84f21d
commit
b25afb239a
@ -527,6 +527,7 @@ char *TranslateTTDPatchCodes(uint32 grfid, uint8 language_id, bool allow_newline
|
|||||||
case 0x1B:
|
case 0x1B:
|
||||||
case 0x1C:
|
case 0x1C:
|
||||||
case 0x1D:
|
case 0x1D:
|
||||||
|
case 0x1E:
|
||||||
d += Utf8Encode(d, SCC_NEWGRF_PRINT_DWORD_DATE_LONG + code - 0x16);
|
d += Utf8Encode(d, SCC_NEWGRF_PRINT_DWORD_DATE_LONG + code - 0x16);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -996,6 +997,7 @@ uint RemapNewGRFStringControlCode(uint scc, char *buf_start, char **buff, const
|
|||||||
case SCC_NEWGRF_PRINT_WORD_WEIGHT_SHORT:
|
case SCC_NEWGRF_PRINT_WORD_WEIGHT_SHORT:
|
||||||
case SCC_NEWGRF_PRINT_WORD_POWER:
|
case SCC_NEWGRF_PRINT_WORD_POWER:
|
||||||
case SCC_NEWGRF_PRINT_WORD_STATION_NAME:
|
case SCC_NEWGRF_PRINT_WORD_STATION_NAME:
|
||||||
|
case SCC_NEWGRF_PRINT_WORD_CARGO_NAME:
|
||||||
if (argv_size < 1) {
|
if (argv_size < 1) {
|
||||||
DEBUG(misc, 0, "Too many NewGRF string parameters.");
|
DEBUG(misc, 0, "Too many NewGRF string parameters.");
|
||||||
return 0;
|
return 0;
|
||||||
@ -1059,6 +1061,10 @@ uint RemapNewGRFStringControlCode(uint scc, char *buf_start, char **buff, const
|
|||||||
case SCC_NEWGRF_PRINT_WORD_STRING_ID:
|
case SCC_NEWGRF_PRINT_WORD_STRING_ID:
|
||||||
*argv = MapGRFStringID(_newgrf_textrefstack.grffile->grfid, _newgrf_textrefstack.PopUnsignedWord());
|
*argv = MapGRFStringID(_newgrf_textrefstack.grffile->grfid, _newgrf_textrefstack.PopUnsignedWord());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SCC_NEWGRF_PRINT_WORD_CARGO_NAME:
|
||||||
|
*argv = 1 << GetCargoTranslation(_newgrf_textrefstack.PopUnsignedWord(), _newgrf_textrefstack.grffile);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Consume additional parameter characters */
|
/* Consume additional parameter characters */
|
||||||
@ -1128,6 +1134,9 @@ uint RemapNewGRFStringControlCode(uint scc, char *buf_start, char **buff, const
|
|||||||
case SCC_NEWGRF_PRINT_WORD_CARGO_TINY:
|
case SCC_NEWGRF_PRINT_WORD_CARGO_TINY:
|
||||||
return SCC_CARGO_TINY;
|
return SCC_CARGO_TINY;
|
||||||
|
|
||||||
|
case SCC_NEWGRF_PRINT_WORD_CARGO_NAME:
|
||||||
|
return SCC_CARGO_LIST;
|
||||||
|
|
||||||
case SCC_NEWGRF_PRINT_WORD_STATION_NAME:
|
case SCC_NEWGRF_PRINT_WORD_STATION_NAME:
|
||||||
return SCC_STATION_NAME;
|
return SCC_STATION_NAME;
|
||||||
|
|
||||||
|
@ -143,6 +143,7 @@ enum StringControlCode {
|
|||||||
SCC_NEWGRF_PRINT_WORD_CARGO_LONG, ///< 9A 1B: Read 2 + 2 bytes from the stack as cargo type (translated) and unsigned cargo amount
|
SCC_NEWGRF_PRINT_WORD_CARGO_LONG, ///< 9A 1B: Read 2 + 2 bytes from the stack as cargo type (translated) and unsigned cargo amount
|
||||||
SCC_NEWGRF_PRINT_WORD_CARGO_SHORT, ///< 9A 1C: Read 2 + 2 bytes from the stack as cargo type (translated) and unsigned cargo amount
|
SCC_NEWGRF_PRINT_WORD_CARGO_SHORT, ///< 9A 1C: Read 2 + 2 bytes from the stack as cargo type (translated) and unsigned cargo amount
|
||||||
SCC_NEWGRF_PRINT_WORD_CARGO_TINY, ///< 9A 1D: Read 2 + 2 bytes from the stack as cargo type (translated) and unsigned cargo amount
|
SCC_NEWGRF_PRINT_WORD_CARGO_TINY, ///< 9A 1D: Read 2 + 2 bytes from the stack as cargo type (translated) and unsigned cargo amount
|
||||||
|
SCC_NEWGRF_PRINT_WORD_CARGO_NAME, ///< 9A 1E: Read 2 bytes from the stack as cargo name
|
||||||
SCC_NEWGRF_PUSH_WORD, ///< 9A 03: Pushes 2 bytes onto the stack
|
SCC_NEWGRF_PUSH_WORD, ///< 9A 03: Pushes 2 bytes onto the stack
|
||||||
SCC_NEWGRF_UNPRINT, ///< 9A 04: "Unprints" the given number of bytes from the string
|
SCC_NEWGRF_UNPRINT, ///< 9A 04: "Unprints" the given number of bytes from the string
|
||||||
SCC_NEWGRF_DISCARD_WORD, ///< 85: Discard the next two bytes
|
SCC_NEWGRF_DISCARD_WORD, ///< 85: Discard the next two bytes
|
||||||
|
Loading…
Reference in New Issue
Block a user