1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Fix negative QColor values

This commit is contained in:
MichalZr6
2024-08-17 01:23:42 +02:00
parent 568a792f88
commit a82ce2f96a
2 changed files with 5 additions and 6 deletions

View File

@@ -48,9 +48,10 @@ void Graphics::loadPaletteAndColors()
for(int i = 0; i < 256; ++i)
{
QColor col;
col.setRed(pals[startPoint++]);
col.setGreen(pals[startPoint++]);
col.setBlue(pals[startPoint++]);
// Cast to unsigned char to ensure values are in the range 0-255
col.setRed(static_cast<uint8_t>(pals[startPoint++]));
col.setGreen(static_cast<uint8_t>(pals[startPoint++]));
col.setBlue(static_cast<uint8_t>(pals[startPoint++]));
col.setAlpha(255);
startPoint++;
playerColorPalette[i] = col.rgba();