Changeset - r27493:b0949c89ac5a
[Not reviewed]
master
0 4 0
PeterN - 12 months ago 2023-06-04 11:14:56
peter1138@openttd.org
Remove: obsolete NewGRF text unprinting. (#10884)

Co-authored-by: Rubidium <rubidium@openttd.org>
4 files changed with 3 insertions and 14 deletions:
0 comments (0 inline, 0 general)
src/newgrf_text.cpp
Show inline comments
 
@@ -357,11 +357,6 @@ std::string TranslateTTDPatchCodes(uint3
 
						Utf8Encode(d, tmp);
 
						break;
 
					}
 
					case 0x04:
 
						if (src[0] == '\0') goto string_end;
 
						Utf8Encode(d, SCC_NEWGRF_UNPRINT);
 
						Utf8Encode(d, *src++);
 
						break;
 
					case 0x06: Utf8Encode(d, SCC_NEWGRF_PRINT_BYTE_HEX);          break;
 
					case 0x07: Utf8Encode(d, SCC_NEWGRF_PRINT_WORD_HEX);          break;
 
					case 0x08: Utf8Encode(d, SCC_NEWGRF_PRINT_DWORD_HEX);         break;
 
@@ -846,14 +841,13 @@ void RewindTextRefStack()
 
/**
 
 * FormatString for NewGRF specific "magic" string control codes
 
 * @param scc   the string control code that has been read
 
 * @param buff  the buffer we're writing to
 
 * @param str   the string that we need to write
 
 * @param argv  the OpenTTD stack of values
 
 * @param argv_size space on the stack \a argv
 
 * @param modify_argv When true, modify the OpenTTD stack.
 
 * @return the string control code to "execute" now
 
 */
 
uint RemapNewGRFStringControlCode(uint scc, char *buf_start, char **buff, const char **str, int64 *argv, uint argv_size, bool modify_argv)
 
uint RemapNewGRFStringControlCode(uint scc, const char **str, int64 *argv, uint argv_size, bool modify_argv)
 
{
 
	switch (scc) {
 
		default: break;
 
@@ -939,7 +933,6 @@ uint RemapNewGRFStringControlCode(uint s
 

	
 
			case SCC_NEWGRF_ROTATE_TOP_4_WORDS:     _newgrf_textrefstack.RotateTop4Words(); break;
 
			case SCC_NEWGRF_PUSH_WORD:              _newgrf_textrefstack.PushWord(Utf8Consume(str)); break;
 
			case SCC_NEWGRF_UNPRINT:                *buff = std::max(*buff - Utf8Consume(str), buf_start); break;
 

	
 
			case SCC_NEWGRF_PRINT_WORD_CARGO_LONG:
 
			case SCC_NEWGRF_PRINT_WORD_CARGO_SHORT:
 
@@ -964,7 +957,6 @@ uint RemapNewGRFStringControlCode(uint s
 
			default: break;
 

	
 
			case SCC_NEWGRF_PUSH_WORD:
 
			case SCC_NEWGRF_UNPRINT:
 
				Utf8Consume(str);
 
				break;
 
		}
 
@@ -1040,7 +1032,6 @@ uint RemapNewGRFStringControlCode(uint s
 
		case SCC_NEWGRF_DISCARD_WORD:
 
		case SCC_NEWGRF_ROTATE_TOP_4_WORDS:
 
		case SCC_NEWGRF_PUSH_WORD:
 
		case SCC_NEWGRF_UNPRINT:
 
			return 0;
 
	}
 
}
src/newgrf_text.h
Show inline comments
 
@@ -49,7 +49,7 @@ void RewindTextRefStack();
 
bool UsingNewGRFTextStack();
 
struct TextRefStack *CreateTextRefStackBackup();
 
void RestoreTextRefStackBackup(struct TextRefStack *backup);
 
uint RemapNewGRFStringControlCode(uint scc, char *buf_start, char **buff, const char **str, int64 *argv, uint argv_size, bool modify_argv);
 
uint RemapNewGRFStringControlCode(uint scc, const char **str, int64 *argv, uint argv_size, bool modify_argv);
 

	
 
/** Mapping of language data between a NewGRF and OpenTTD. */
 
struct LanguageMap {
src/strings.cpp
Show inline comments
 
@@ -836,7 +836,6 @@ static char *FormatString(char *buff, co
 
	}
 
	WChar b = '\0';
 
	uint next_substr_case_index = 0;
 
	char *buf_start = buff;
 
	std::stack<const char *, std::vector<const char *>> str_stack;
 
	str_stack.push(str_arg);
 

	
 
@@ -850,7 +849,7 @@ static char *FormatString(char *buff, co
 
		if (SCC_NEWGRF_FIRST <= b && b <= SCC_NEWGRF_LAST) {
 
			/* We need to pass some stuff as it might be modified. */
 
			//todo: should argve be passed here too?
 
			b = RemapNewGRFStringControlCode(b, buf_start, &buff, &str, (int64 *)args->GetDataPointer(), args->GetDataLeft(), dry_run);
 
			b = RemapNewGRFStringControlCode(b, &str, (int64 *)args->GetDataPointer(), args->GetDataLeft(), dry_run);
 
			if (b == 0) continue;
 
		}
 

	
src/table/control_codes.h
Show inline comments
 
@@ -150,7 +150,6 @@ enum StringControlCode {
 
	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
 
	SCC_NEWGRF_ROTATE_TOP_4_WORDS,                    ///< 86: Rotate the top 4 words of the stack (W4 W1 W2 W3)
 
	SCC_NEWGRF_LAST = SCC_NEWGRF_ROTATE_TOP_4_WORDS,
0 comments (0 inline, 0 general)