Changeset - r17959:3333394afc38
[Not reviewed]
master
0 2 0
frosch - 13 years ago 2011-08-20 22:35:11
frosch@openttd.org
(svn r22778) -Add: [NewGRF] Stringcodes for printing 0-based dates. (Hirundo)
2 files changed with 11 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/newgrf_text.cpp
Show inline comments
 
@@ -567,6 +567,9 @@ char *TranslateTTDPatchCodes(uint32 grfi
 
						}
 
						break;
 

	
 
					case 0x16:
 
					case 0x17: d += Utf8Encode(d, SCC_NEWGRF_PRINT_DWORD_DATE_LONG + code - 0x16); break;
 

	
 
					default:
 
						grfmsg(1, "missing handler for extended format code");
 
						break;
 
@@ -1017,7 +1020,6 @@ uint RemapNewGRFStringControlCode(uint s
 
			case SCC_NEWGRF_PRINT_DWORD_SIGNED:     *argv = _newgrf_textrefstack.PopSignedDWord();   break;
 

	
 
			case SCC_NEWGRF_PRINT_BYTE_HEX:         *argv = _newgrf_textrefstack.PopUnsignedByte();  break;
 
			case SCC_NEWGRF_PRINT_DWORD_HEX:        *argv = _newgrf_textrefstack.PopUnsignedDWord(); break;
 
			case SCC_NEWGRF_PRINT_QWORD_HEX:        *argv = _newgrf_textrefstack.PopUnsignedQWord(); break;
 

	
 
			case SCC_NEWGRF_PRINT_WORD_HEX:
 
@@ -1027,6 +1029,10 @@ 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_DATE_LONG:
 
			case SCC_NEWGRF_PRINT_DWORD_DATE_SHORT:
 
			case SCC_NEWGRF_PRINT_DWORD_HEX:        *argv = _newgrf_textrefstack.PopUnsignedDWord(); break;
 

	
 
			case SCC_NEWGRF_PRINT_WORD_DATE_LONG:
 
			case SCC_NEWGRF_PRINT_WORD_DATE_SHORT:  *argv = _newgrf_textrefstack.PopUnsignedWord() + DAYS_TILL_ORIGINAL_BASE_YEAR; break;
 

	
 
@@ -1064,9 +1070,11 @@ uint RemapNewGRFStringControlCode(uint s
 
			return SCC_NEWGRF_PRINT_WORD_STRING_ID;
 

	
 
		case SCC_NEWGRF_PRINT_WORD_DATE_LONG:
 
		case SCC_NEWGRF_PRINT_DWORD_DATE_LONG:
 
			return SCC_DATE_LONG;
 

	
 
		case SCC_NEWGRF_PRINT_WORD_DATE_SHORT:
 
		case SCC_NEWGRF_PRINT_DWORD_DATE_SHORT:
 
			return SCC_DATE_SHORT;
 

	
 
		case SCC_NEWGRF_PRINT_WORD_SPEED:
src/table/control_codes.h
Show inline comments
 
@@ -129,6 +129,8 @@ enum StringControlCode {
 
	SCC_NEWGRF_PRINT_WORD_HEX,                        ///< Read 2 bytes from the stack and print it as hex
 
	SCC_NEWGRF_PRINT_DWORD_HEX,                       ///< Read 4 bytes from the stack and print it as hex
 
	SCC_NEWGRF_PRINT_QWORD_HEX,                       ///< Read 8 bytes from the stack and print it as hex
 
	SCC_NEWGRF_PRINT_DWORD_DATE_LONG,                 ///< Read 4 bytes from the stack as base 0 date
 
	SCC_NEWGRF_PRINT_DWORD_DATE_SHORT,                ///< Read 4 bytes from the stack as base 0 date
 
	SCC_NEWGRF_PUSH_WORD,                             ///< Pushes 2 bytes onto the stack
 
	SCC_NEWGRF_UNPRINT,                               ///< "Unprints" the given number of bytes from the string
 
	SCC_NEWGRF_DISCARD_WORD,                          ///< Discard the next two bytes
0 comments (0 inline, 0 general)