mirror of https://github.com/OpenTTD/OpenTTD
(svn r21637) -Codechange: make it more clear that IS_PALETTE_COLOUR belongs to TextColour
parent
13c5cd820b
commit
2c41b8ee97
|
@ -118,8 +118,8 @@ void SetLocalCompany(CompanyID new_company)
|
||||||
*/
|
*/
|
||||||
uint16 GetDrawStringCompanyColour(CompanyID company)
|
uint16 GetDrawStringCompanyColour(CompanyID company)
|
||||||
{
|
{
|
||||||
if (!Company::IsValidID(company)) return _colour_gradient[COLOUR_WHITE][4] | IS_PALETTE_COLOUR;
|
if (!Company::IsValidID(company)) return _colour_gradient[COLOUR_WHITE][4] | TC_IS_PALETTE_COLOUR;
|
||||||
return (_colour_gradient[_company_colours[company]][4]) | IS_PALETTE_COLOUR;
|
return (_colour_gradient[_company_colours[company]][4]) | TC_IS_PALETTE_COLOUR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -284,8 +284,8 @@ static void SetColourRemap(TextColour colour)
|
||||||
{
|
{
|
||||||
if (colour == TC_INVALID) return;
|
if (colour == TC_INVALID) return;
|
||||||
|
|
||||||
if (colour & IS_PALETTE_COLOUR) {
|
if (colour & TC_IS_PALETTE_COLOUR) {
|
||||||
_string_colourremap[1] = colour & ~IS_PALETTE_COLOUR;
|
_string_colourremap[1] = colour & ~TC_IS_PALETTE_COLOUR;
|
||||||
_string_colourremap[2] = (_use_palette == PAL_DOS) ? 1 : 215;
|
_string_colourremap[2] = (_use_palette == PAL_DOS) ? 1 : 215;
|
||||||
} else {
|
} else {
|
||||||
_string_colourremap[1] = _string_colourmap[_use_palette][colour].text;
|
_string_colourremap[1] = _string_colourmap[_use_palette][colour].text;
|
||||||
|
|
|
@ -224,7 +224,7 @@ enum TextColour {
|
||||||
TC_BLACK = 0x10,
|
TC_BLACK = 0x10,
|
||||||
TC_INVALID = 0xFF,
|
TC_INVALID = 0xFF,
|
||||||
|
|
||||||
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.
|
||||||
};
|
};
|
||||||
DECLARE_ENUM_AS_BIT_SET(TextColour)
|
DECLARE_ENUM_AS_BIT_SET(TextColour)
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ void CDECL NetworkAddChatMessage(TextColour colour, uint duration, const char *m
|
||||||
|
|
||||||
/* The default colour for a message is company colour. Replace this with
|
/* The default colour for a message is company colour. Replace this with
|
||||||
* white for any additional lines */
|
* white for any additional lines */
|
||||||
cmsg->colour = (bufp == buf && (colour & IS_PALETTE_COLOUR)) ? colour : TC_WHITE;
|
cmsg->colour = (bufp == buf && (colour & TC_IS_PALETTE_COLOUR)) ? colour : TC_WHITE;
|
||||||
cmsg->remove_time = _realtime_tick + duration * 1000;
|
cmsg->remove_time = _realtime_tick + duration * 1000;
|
||||||
|
|
||||||
bufp += strlen(bufp) + 1; // jump to 'next line' in the formatted string
|
bufp += strlen(bufp) + 1; // jump to 'next line' in the formatted string
|
||||||
|
|
|
@ -1407,9 +1407,9 @@ static void ViewportDrawStrings(DrawPixelInfo *dpi, const StringSpriteToDrawVect
|
||||||
/* if we didn't draw a rectangle, or if transparant building is on,
|
/* if we didn't draw a rectangle, or if transparant building is on,
|
||||||
* draw the text in the colour the rectangle would have */
|
* draw the text in the colour the rectangle would have */
|
||||||
if (IsTransparencySet(TO_SIGNS) && ss->string != STR_WHITE_SIGN) {
|
if (IsTransparencySet(TO_SIGNS) && ss->string != STR_WHITE_SIGN) {
|
||||||
/* Real colours need the IS_PALETTE_COLOUR flag
|
/* Real colours need the TC_IS_PALETTE_COLOUR flag
|
||||||
* otherwise colours from _string_colourmap are assumed. */
|
* otherwise colours from _string_colourmap are assumed. */
|
||||||
colour = (TextColour)_colour_gradient[ss->colour][6] | IS_PALETTE_COLOUR;
|
colour = (TextColour)_colour_gradient[ss->colour][6] | TC_IS_PALETTE_COLOUR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draw the rectangle if 'tranparent station signs' is off,
|
/* Draw the rectangle if 'tranparent station signs' is off,
|
||||||
|
|
Loading…
Reference in New Issue