shithub: rgbds

Download patch

ref: 973fbb91bc3474006a1612bfd4ce72b466d30a3d
parent: 903862c4514cbd63d56c8565898304e1d3f2c0be
author: ISSOtm <[email protected]>
date: Sat May 21 11:46:33 EDT 2022

Improve error message when a tile has too many colors

--- a/src/gfx/process.cpp
+++ b/src/gfx/process.cpp
@@ -741,7 +741,6 @@
 
 namespace unoptimized {
 
-// TODO: this is very redundant with `TileData::TileData`; try merging both?
 static void outputTileData(Png const &png, DefaultInitVec<AttrmapEntry> const &attrmap,
                            std::vector<Palette> const &palettes,
                            DefaultInitVec<size_t> const &mappings) {
@@ -1004,9 +1003,9 @@
 			}
 		}
 
-		// TODO: nicer error message
 		if (tileColors.size() > options.maxOpaqueColors()) {
-			fatal("Too many colors in tile at (%" PRIu32 ", %" PRIu32 ")", tile.x, tile.y);
+			fatal("Tile at (%" PRIu32 ", %" PRIu32 ") has %zu opaque colors, more than %" PRIu8 "!",
+			      tile.x, tile.y, tileColors.size(), options.maxOpaqueColors());
 		}
 
 		attrs.protoPaletteID = protoPalettes.size();