From 56af6644fbe5c25bfd73370cfad2830dfcbcc2f8 Mon Sep 17 00:00:00 2001 From: Rogier Date: Wed, 13 Jan 2016 10:30:18 +0100 Subject: [PATCH] Improve parsing of heightmap colors file Error detection was not entirely correct --- TileGenerator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TileGenerator.cpp b/TileGenerator.cpp index db15b1c..94525e4 100644 --- a/TileGenerator.cpp +++ b/TileGenerator.cpp @@ -706,7 +706,7 @@ void TileGenerator::parseHeightMapColorsLine(const std::string &line, std::strin iline.clear(); iline >> std::ws; iline >> value >> std::ws; - if (iline.good()) { + if (!iline.fail()) { if (value == "-oo" || (c == '-' && value=="oo")) height[i] = INT_MIN; else if (value == "oo" || value == "+oo") @@ -755,7 +755,7 @@ void TileGenerator::parseHeightMapNodesLine(const std::string &line, std::string m_nodeColors[name] = ColorEntry(0,0,0,255,1,0); // Dummy entry - but must not be transparent } // Don't care if not at eof (== really eol). We might be reading a colors.txt file... - if (iline.bad()) { + if (iline.fail()) { std::cerr << filename << ":" << linenr << ": bad line in heightmap nodes file (" << line << ")" << std::endl; return; }