mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r21702) -Fix: make sure the colour argument of echoc is properly validated to be a text colour
This commit is contained in:
parent
b25cf57542
commit
37b9c31118
|
@ -958,7 +958,7 @@ DEF_CONSOLE_CMD(ConEchoC)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc < 3) return false;
|
if (argc < 3) return false;
|
||||||
IConsolePrint((TextColour)atoi(argv[1]), argv[2]);
|
IConsolePrint((TextColour)Clamp(atoi(argv[1]), TC_BEGIN, TC_END - 1), argv[2]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -204,6 +204,7 @@ template <> struct EnumPropsT<Colours> : MakeEnumPropsT<Colours, byte, COLOUR_DA
|
||||||
|
|
||||||
/** Colour of the strings, see _string_colourmap in table/palettes.h or docs/ottd-colourtext-palette.png */
|
/** Colour of the strings, see _string_colourmap in table/palettes.h or docs/ottd-colourtext-palette.png */
|
||||||
enum TextColour {
|
enum TextColour {
|
||||||
|
TC_BEGIN = 0x00,
|
||||||
TC_FROMSTRING = 0x00,
|
TC_FROMSTRING = 0x00,
|
||||||
TC_BLUE = 0x00,
|
TC_BLUE = 0x00,
|
||||||
TC_SILVER = 0x01,
|
TC_SILVER = 0x01,
|
||||||
|
@ -222,6 +223,7 @@ enum TextColour {
|
||||||
TC_GREY = 0x0E,
|
TC_GREY = 0x0E,
|
||||||
TC_DARK_BLUE = 0x0F,
|
TC_DARK_BLUE = 0x0F,
|
||||||
TC_BLACK = 0x10,
|
TC_BLACK = 0x10,
|
||||||
|
TC_END,
|
||||||
TC_INVALID = 0xFF,
|
TC_INVALID = 0xFF,
|
||||||
|
|
||||||
TC_IS_PALETTE_COLOUR = 0x100, ///< Colour value is already a real palette colour index, not an index of a StringColour.
|
TC_IS_PALETTE_COLOUR = 0x100, ///< Colour value is already a real palette colour index, not an index of a StringColour.
|
||||||
|
|
Loading…
Reference in New Issue