parseColorsStream: fix comment stripping

p is incremented too soon to be able to see '#' on first character.
Use a conventional for loop.
This commit is contained in:
Christophe Le Roy
2016-10-08 20:05:03 +02:00
parent 5558c3dd63
commit 5a174e7980

View File

@ -261,16 +261,15 @@ void TileGenerator::generate(const std::string &input, const std::string &output
void TileGenerator::parseColorsStream(std::istream &in) void TileGenerator::parseColorsStream(std::istream &in)
{ {
char line[128], *p; char line[128];
while (in.good()) { while (in.good()) {
in.getline(line, 128); in.getline(line, 128);
p = line; for (char *p = line; *p != '\0'; ++p) {
while(*p++ != '\0') { if(*p == '#') {
if(*p != '#')
continue;
*p = '\0'; // Cut off at the first # *p = '\0'; // Cut off at the first #
break; break;
} }
}
char name[64]; char name[64];
unsigned int r, g, b, a, t; unsigned int r, g, b, a, t;