aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/mads/palette.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp
index 250c98b074..b41eaedfcc 100644
--- a/engines/mads/palette.cpp
+++ b/engines/mads/palette.cpp
@@ -888,19 +888,19 @@ void Palette::refreshSceneColors() {
int Palette::closestColor(const byte *matchColor, const byte *refPalette,
int listWrap, int count) {
int bestColor = 0;
- int bestDifference = 0x7fff;
+ int bestDistance = 0x7fff;
for (int idx = 0; idx < count; ++idx) {
// Figure out hash for color
- int hash = 0;
+ int distance = 0;
for (int rgbIdx = 0; rgbIdx < 3; ++rgbIdx, ++refPalette) {
byte diff = *refPalette - matchColor[rgbIdx];
- hash += (int)diff * (int)diff;
+ distance += (int)diff * (int)diff;
}
// If the given color is a closer match to our color, store the index
- if (hash < bestDifference) {
- bestDifference = hash;
+ if (distance < bestDistance) {
+ bestDistance = distance;
bestColor = idx;
}