Add string control code to consume an argument.

This commit is contained in:
Jonathan G Rennison
2017-03-29 21:15:11 +01:00
parent 7194e19380
commit 688ee9ac11
3 changed files with 8 additions and 0 deletions

View File

@@ -1682,6 +1682,10 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
break; break;
} }
case SCC_CONSUME_ARG:
// do nothing
break;
default: default:
if (buff + Utf8CharLen(b) < last) buff += Utf8Encode(buff, b); if (buff + Utf8CharLen(b) < last) buff += Utf8Encode(buff, b);
break; break;

View File

@@ -116,6 +116,8 @@ enum StringControlCode {
SCC_BLACK, SCC_BLACK,
SCC_PREVIOUS_COLOUR, SCC_PREVIOUS_COLOUR,
SCC_CONSUME_ARG,
/** /**
* The next variables are part of a NewGRF subsystem for creating text strings. * The next variables are part of a NewGRF subsystem for creating text strings.
* It uses a "stack" of bytes and reads from there. * It uses a "stack" of bytes and reads from there.

View File

@@ -139,6 +139,8 @@ static const CmdStruct _cmd_structs[] = {
{"SMALL_LEFT_ARROW", EmitSingleChar, SCC_LESS_THAN, 0, -1, C_DONTCOUNT}, {"SMALL_LEFT_ARROW", EmitSingleChar, SCC_LESS_THAN, 0, -1, C_DONTCOUNT},
{"SMALL_RIGHT_ARROW", EmitSingleChar, SCC_GREATER_THAN, 0, -1, C_DONTCOUNT}, {"SMALL_RIGHT_ARROW", EmitSingleChar, SCC_GREATER_THAN, 0, -1, C_DONTCOUNT},
{"CONSUME_ARG", EmitSingleChar, SCC_CONSUME_ARG, 1, 0, C_NONE},
/* The following are directional formatting codes used to get the RTL strings right: /* The following are directional formatting codes used to get the RTL strings right:
* http://www.unicode.org/unicode/reports/tr9/#Directional_Formatting_Codes */ * http://www.unicode.org/unicode/reports/tr9/#Directional_Formatting_Codes */
{"LRM", EmitSingleChar, CHAR_TD_LRM, 0, -1, C_DONTCOUNT}, {"LRM", EmitSingleChar, CHAR_TD_LRM, 0, -1, C_DONTCOUNT},