From 722f02d121d46cd60282d317d563d2652e8de2c8 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sat, 20 Dec 2014 13:08:51 +0100 Subject: [PATCH] Add workaround for color.txt parsing on MinGW --- TileGenerator.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/TileGenerator.cpp b/TileGenerator.cpp index d862d04..c8cd58b 100644 --- a/TileGenerator.cpp +++ b/TileGenerator.cpp @@ -264,11 +264,20 @@ void TileGenerator::parseColorsStream(std::istream &in) } char name[75]; +#ifdef __MINGW32__ + // MinGW's sscanf doesn't support %hhu + unsigned int r, g, b, a, t; +#else uint8_t r, g, b, a, t; +#endif a = 255; t = 0; +#ifdef __MINGW32__ + sscanf(line, "%75s %u %u %u %u %u", name, &r, &g, &b, &a, &t); +#else sscanf(line, "%75s %hhu %hhu %hhu %hhu %hhu", name, &r, &g, &b, &a, &t); +#endif if(strlen(name) == 0) break; ColorEntry color = ColorEntry(r, g, b, a, t);