diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp --- a/src/newgrf_text.cpp +++ b/src/newgrf_text.cpp @@ -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; } } diff --git a/src/newgrf_text.h b/src/newgrf_text.h --- a/src/newgrf_text.h +++ b/src/newgrf_text.h @@ -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 { diff --git a/src/strings.cpp b/src/strings.cpp --- a/src/strings.cpp +++ b/src/strings.cpp @@ -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> 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; } diff --git a/src/table/control_codes.h b/src/table/control_codes.h --- a/src/table/control_codes.h +++ b/src/table/control_codes.h @@ -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,