Add SET_COLOUR string code

This commit is contained in:
Jonathan G Rennison
2023-07-30 19:08:12 +01:00
parent ccbf789ea0
commit ebcf8b336c
3 changed files with 10 additions and 0 deletions

View File

@@ -1304,6 +1304,14 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
break;
}
case SCC_SET_COLOUR: {// {SET_COLOUR}
int64 tc = args->GetInt64(SCC_SET_COLOUR);
if (tc >= 0 && tc < TC_END) {
buff += Utf8Encode(buff, SCC_BLUE + tc);
}
break;
}
case SCC_REVISION: // {REV}
buff = strecpy(buff, _openttd_revision, last);
break;

View File

@@ -132,6 +132,7 @@ enum StringControlCode {
SCC_BLACK,
SCC_PUSH_COLOUR,
SCC_POP_COLOUR,
SCC_SET_COLOUR,
SCC_CONSUME_ARG,

View File

@@ -60,6 +60,7 @@ static const CmdStruct _cmd_structs[] = {
{"BLACK", EmitSingleChar, SCC_BLACK, 0, -1, C_DONTCOUNT},
{"PUSH_COLOUR", EmitSingleChar, SCC_PUSH_COLOUR, 0, -1, C_DONTCOUNT},
{"POP_COLOUR", EmitSingleChar, SCC_POP_COLOUR, 0, -1, C_DONTCOUNT},
{"SET_COLOUR", EmitSingleChar, SCC_SET_COLOUR, 1, -1, C_NONE},
{"REV", EmitSingleChar, SCC_REVISION, 0, -1, C_NONE}, // openttd revision string