diff --git a/Color.h b/Color.h index a8ec544..20a35e0 100644 --- a/Color.h +++ b/Color.h @@ -24,6 +24,7 @@ struct ColorEntry { enum flags { FlagNone = 0x00, FlagIgnore = 0x01, + FlagAir = 0x02, }; ColorEntry(): r(0), g(0), b(0), a(0), t(0), f(0) {}; ColorEntry(uint8_t r, uint8_t g, uint8_t b, uint8_t a, uint8_t t, uint8_t f): r(r), g(g), b(b), a(a), t(t), f(f) {}; diff --git a/TileGenerator.cpp b/TileGenerator.cpp index a875c80..212faef 100644 --- a/TileGenerator.cpp +++ b/TileGenerator.cpp @@ -648,6 +648,8 @@ void TileGenerator::parseNodeColorsLine(const std::string &line, std::string nam while (!iflags.fail()) { if (flag == "ignore") f |= ColorEntry::FlagIgnore; + else if (flag == "air") + f |= ColorEntry::FlagAir; iflags >> flag; } } @@ -1667,9 +1669,18 @@ void TileGenerator::processMapBlock(const DB::Block &block) } else { if (color != m_nodeColors.end()) { + // Colors marked 'ignore' take precedence over 'air' if ((color->second.f & ColorEntry::FlagIgnore)) { m_nodeIDColor[nodeId] = NodeColorNotDrawn; } + // If the color is marked 'air', then treat it accordingly. + else if ((color->second.f & ColorEntry::FlagAir)) { + if (m_drawAir) + m_nodeIDColor[nodeId] = &color->second; + else + m_nodeIDColor[nodeId] = NodeColorNotDrawn; + } + // Regular node. else { m_nodeIDColor[nodeId] = &color->second; }