Fix negative QColor values

This commit is contained in:
MichalZr6 committed 2024-08-23 09:43:40 +02:00
1 parent 568a792f88
commit a82ce2f96a
2 files changed
+5 -6

No files matched your search

@@ -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())
+4 -3
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();