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
1 changed files with 6 additions and 7 deletions

View File

@ -261,15 +261,14 @@ 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 != '#') *p = '\0'; // Cut off at the first #
continue; break;
*p = '\0'; // Cut off at the first # }
break;
} }
char name[64]; char name[64];