1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +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

@ -317,12 +317,10 @@ void CObjectClassesHandler::loadObject(std::string scope, std::string name, cons
VLC->identifiersHandler->registerObject(scope, "object", name, mapObjectTypes.at(index)->id);
}
#pragma optimize("", off)
void CObjectClassesHandler::loadSubObject(const std::string & identifier, JsonNode config, MapObjectID ID, MapObjectSubID subID)
{
config.setType(JsonNode::JsonType::DATA_STRUCT); // ensure that input is not NULL
if (identifier == "ranger")
logGlobal->warn("subID of rangers: "+ std::to_string(subID.getNum()));
assert(mapObjectTypes.at(ID.getNum()));
if (subID.getNum() >= mapObjectTypes.at(ID.getNum())->objectTypeHandlers.size())

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();