mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-17 00:07:41 +02:00
Fix negative QColor values
This commit is contained in:
@ -317,12 +317,10 @@ void CObjectClassesHandler::loadObject(std::string scope, std::string name, cons
|
|||||||
VLC->identifiersHandler->registerObject(scope, "object", name, mapObjectTypes.at(index)->id);
|
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)
|
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
|
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()));
|
assert(mapObjectTypes.at(ID.getNum()));
|
||||||
|
|
||||||
if (subID.getNum() >= mapObjectTypes.at(ID.getNum())->objectTypeHandlers.size())
|
if (subID.getNum() >= mapObjectTypes.at(ID.getNum())->objectTypeHandlers.size())
|
||||||
|
@ -48,9 +48,10 @@ void Graphics::loadPaletteAndColors()
|
|||||||
for(int i = 0; i < 256; ++i)
|
for(int i = 0; i < 256; ++i)
|
||||||
{
|
{
|
||||||
QColor col;
|
QColor col;
|
||||||
col.setRed(pals[startPoint++]);
|
// Cast to unsigned char to ensure values are in the range 0-255
|
||||||
col.setGreen(pals[startPoint++]);
|
col.setRed(static_cast<uint8_t>(pals[startPoint++]));
|
||||||
col.setBlue(pals[startPoint++]);
|
col.setGreen(static_cast<uint8_t>(pals[startPoint++]));
|
||||||
|
col.setBlue(static_cast<uint8_t>(pals[startPoint++]));
|
||||||
col.setAlpha(255);
|
col.setAlpha(255);
|
||||||
startPoint++;
|
startPoint++;
|
||||||
playerColorPalette[i] = col.rgba();
|
playerColorPalette[i] = col.rgba();
|
||||||
|
Reference in New Issue
Block a user