mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Off-by-one in colour gradient initialisation.
Remap sprites start with a count byte followed by 256 entries, but SetupColoursAndInitialWindow did not take account of this extra byte and therefore started at palette index 0xC5 instead of 0xC6. This caused the first colour of each gradient to be incorrect and all shades were actually 1 step lower in the gradient than indicated.pull/12169/head
parent
2c8b8464cb
commit
0b5b47117c
|
@ -541,7 +541,7 @@ void ShowSelectGameWindow();
|
|||
void SetupColoursAndInitialWindow()
|
||||
{
|
||||
for (Colours i = COLOUR_BEGIN; i != COLOUR_END; i++) {
|
||||
const byte *b = GetNonSprite(GENERAL_SPRITE_COLOUR(i), SpriteType::Recolour);
|
||||
const byte *b = GetNonSprite(GENERAL_SPRITE_COLOUR(i), SpriteType::Recolour) + 1;
|
||||
assert(b != nullptr);
|
||||
for (ColourShade j = SHADE_BEGIN; j < SHADE_END; j++) {
|
||||
SetColourGradient(i, j, b[0xC6 + j]);
|
||||
|
|
|
@ -42,13 +42,14 @@ TextColour GetContrastColour(uint8_t background, uint8_t threshold = 128);
|
|||
|
||||
enum ColourShade : uint8_t {
|
||||
SHADE_BEGIN = 0,
|
||||
SHADE_DARKEST,
|
||||
SHADE_DARKEST = SHADE_BEGIN,
|
||||
SHADE_DARKER,
|
||||
SHADE_DARK,
|
||||
SHADE_NORMAL,
|
||||
SHADE_LIGHT,
|
||||
SHADE_LIGHTER,
|
||||
SHADE_LIGHTEST,
|
||||
SHADE_LIGHTEREST,
|
||||
SHADE_END,
|
||||
};
|
||||
DECLARE_POSTFIX_INCREMENT(ColourShade)
|
||||
|
|
Loading…
Reference in New Issue