Factor out MAX_NB_PALETTES constant

This commit is contained in:
Rangi authored and Eldred Habert committed 2026-11-29 13:02:53 +01:00
1 parent 2bbaef0541
commit 02e80336d4
2 files changed
+3 -2

No files matched your search

+1
View File
@@ -19,6 +19,7 @@ static constexpr uint32_t TILE_WIDTH = 8; // in pixels
static constexpr uint32_t TILE_HEIGHT = 8; // in pixels
static constexpr size_t MAX_PAL_COLORS = 4;
static constexpr size_t MAX_NB_PALETTES = 256;
// Forward declaration so `inputSlice`'s `bottom` method inside `Options` can refer to `options`.
struct Options;
+2 -2
View File
@@ -358,8 +358,8 @@ static void parseArg(int ch, char *arg) {
case 'n':
if (std::optional<uint64_t> number = parseWholeNumber(argPtr); !number) {
error("Invalid argument for number of palettes");
} else if (*number > 256) {
error("Number of palettes must not exceed 256");
} else if (*number > MAX_NB_PALETTES) {
error("Number of palettes must not exceed %zu", MAX_NB_PALETTES);
} else if (*number == 0) {
error("Number of palettes may not be 0");
} else {