Changeset - r27322:150e199e081f
[Not reviewed]
master
0 2 0
PeterN - 13 months ago 2023-05-11 07:06:46
peter1138@openttd.org
Add: NewGRF string code "9A 21" to display force from textstack. (#10782)
2 files changed with 8 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/newgrf_text.cpp
Show inline comments
 
@@ -445,6 +445,8 @@ std::string TranslateTTDPatchCodes(uint3
 
					case 0x1F: Utf8Encode(d, SCC_PUSH_COLOUR); break;
 
					case 0x20: Utf8Encode(d, SCC_POP_COLOUR);  break;
 

	
 
					case 0x21: Utf8Encode(d, SCC_NEWGRF_PRINT_DWORD_FORCE); break;
 

	
 
					default:
 
						GrfMsg(1, "missing handler for extended format code");
 
						break;
 
@@ -882,6 +884,7 @@ uint RemapNewGRFStringControlCode(uint s
 
		case SCC_NEWGRF_PRINT_WORD_WEIGHT_LONG:
 
		case SCC_NEWGRF_PRINT_WORD_WEIGHT_SHORT:
 
		case SCC_NEWGRF_PRINT_WORD_POWER:
 
		case SCC_NEWGRF_PRINT_DWORD_FORCE:
 
		case SCC_NEWGRF_PRINT_WORD_STATION_NAME:
 
		case SCC_NEWGRF_PRINT_WORD_CARGO_NAME:
 
			if (argv_size < 1) {
 
@@ -927,6 +930,7 @@ uint RemapNewGRFStringControlCode(uint s
 
			case SCC_NEWGRF_PRINT_WORD_STATION_NAME:
 
			case SCC_NEWGRF_PRINT_WORD_UNSIGNED:    *argv = _newgrf_textrefstack.PopUnsignedWord();  break;
 

	
 
			case SCC_NEWGRF_PRINT_DWORD_FORCE:
 
			case SCC_NEWGRF_PRINT_DWORD_DATE_LONG:
 
			case SCC_NEWGRF_PRINT_DWORD_DATE_SHORT:
 
			case SCC_NEWGRF_PRINT_DWORD_HEX:        *argv = _newgrf_textrefstack.PopUnsignedDWord(); break;
 
@@ -1018,6 +1022,9 @@ uint RemapNewGRFStringControlCode(uint s
 
		case SCC_NEWGRF_PRINT_WORD_POWER:
 
			return SCC_POWER;
 

	
 
		case SCC_NEWGRF_PRINT_DWORD_FORCE:
 
			return SCC_FORCE;
 

	
 
		case SCC_NEWGRF_PRINT_WORD_CARGO_LONG:
 
			return SCC_CARGO_LONG;
 

	
src/table/control_codes.h
Show inline comments
 
@@ -148,6 +148,7 @@ enum StringControlCode {
 
	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_NAME,                 ///< 9A 1E: Read 2 bytes from the stack as cargo name
 
	SCC_NEWGRF_PRINT_DWORD_FORCE,                     ///< 9A 21: Read 4 bytes from the stack as unsigned force
 
	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_DISCARD_WORD,                          ///< 85: Discard the next two bytes
0 comments (0 inline, 0 general)