SCUMM: Fix warnings

This commit is contained in:
AndywinXp 2022-07-05 10:04:43 +02:00 committed by Lothar Serra Mari
parent e78c671b45
commit f0d371d96e
4 changed files with 5 additions and 7 deletions

View file

@ -208,7 +208,7 @@ void ScummEngine_v7::setDefaultCursor() {
white = getPaletteColorFromRGB(palette, inverseRgbIdx, inverseRgbIdx, inverseRgbIdx);
} while (white == 1 && rgbIdx != 100);
for (int i = 0; i < sizeof(default_v8_cursor); ++i) {
for (int i = 0; i < ARRAYSIZE(default_v8_cursor); i++) {
cursorPixel = default_v8_cursor[i];
if (isSmushActive() && cursorPixel == 0x0F)

View file

@ -320,7 +320,7 @@ int ScummEngine_v7::getInternalGUIControlFromCoordinates(int x, int y) {
_internalGUIControls[id].yPos < y) {
id++;
if (id >= sizeof(_internalGUIControls))
if (id >= ARRAYSIZE(_internalGUIControls))
return -1;
}
return id;
@ -453,7 +453,7 @@ void ScummEngine_v7::confirmExitDialog() {
(ks.keycode == Common::KEYCODE_c && ks.hasFlags(Common::KBD_CTRL)));
ctrlId = getInternalGUIControlFromCoordinates(_mouse.x, _mouse.y);
if (leftBtnPressed && ctrlId == 0 || (toupper(ks.ascii) == yesLabelPtr[0]))
if ((leftBtnPressed && ctrlId == 0) || (toupper(ks.ascii) == yesLabelPtr[0]))
quitGame();
// Restore the previous cursor...

View file

@ -1559,9 +1559,9 @@ uint32 ScummEngine::findClosestPaletteColor(byte *palette, int numOfSlots, byte
blueSquareDiff = (b - palette[2]) * (b - palette[2]);
weightedColorError = 3 * redSquareDiff + 5 * greenSquareDiff + 2 * blueSquareDiff;
if (3 * redSquareDiff + 5 * greenSquareDiff + 2 * blueSquareDiff < minErr) {
if (weightedColorError < minErr) {
color = i;
minErr = 3 * redSquareDiff + 5 * greenSquareDiff + 2 * blueSquareDiff;
minErr = weightedColorError;
}
palette += 3;
}

View file

@ -165,7 +165,6 @@ void ScummEngine::copyHeapSaveGameToFile(int slot, const char *saveName) {
Common::String fileName;
SaveGameHeader hdr;
bool saveFailed = false;
uint32 heapFileSize;
Common::SeekableReadStream *heapSaveFile = openSaveFileForReading(1, true, fileName);
hdr.type = heapSaveFile->readUint32BE();
@ -174,7 +173,6 @@ void ScummEngine::copyHeapSaveGameToFile(int slot, const char *saveName) {
heapSaveFile->read(hdr.name, sizeof(hdr.name));
Common::strlcpy(hdr.name, saveName, sizeof(hdr.name));
heapFileSize = (uint32)heapSaveFile->size();
if (heapSaveFile->err() || hdr.type != MKTAG('S','C','V','M')) {
saveFailed = true;
} else {