mirror of
https://github.com/gbdev/rgbds.git
synced 2026-10-06 12:15:39 +00:00
Consistency check the palette map, not just the attribute map
This commit is contained in:
1 parent
d61c0561c1
commit
07f5969005
1 file changed
+21
@@ -419,6 +419,27 @@ void reverse() {
|
|||||||
mapSize
|
mapSize
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (size_t index = 0; index < mapSize; ++index) {
|
||||||
|
size_t tx = index % width, ty = index / width;
|
||||||
|
uint8_t palID = (*palmap)[index];
|
||||||
|
|
||||||
|
// The unsigned underflow for `palOfs` is intentional, since a nonzero
|
||||||
|
// base palette ID may overflow and continue with IDs from 0.
|
||||||
|
if (uint8_t palOfs = (palID - options.basePalID) & 0b111; palOfs >= palettes.size()) {
|
||||||
|
error(
|
||||||
|
"Palette map references palette #%" PRIu8
|
||||||
|
" at (%zu, %zu), but there are only %zu palette%s",
|
||||||
|
palID,
|
||||||
|
tx,
|
||||||
|
ty,
|
||||||
|
palettes.size(),
|
||||||
|
palettes.size() == 1 ? "" : "s"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
requireZeroErrors();
|
||||||
}
|
}
|
||||||
|
|
||||||
verbosePrint(VERB_NOTICE, "Writing image...\n");
|
verbosePrint(VERB_NOTICE, "Writing image...\n");
|
||||||
|
|||||||
Reference in new issue
Block a user