Add a colors.txt node flag for air-type nodes (nodes will be treated as air)
This means that they are only drawn if the option '--drawair' is specified on the command-line. Else they are ignored.master
parent
b3019c1804
commit
ca66635176
1
Color.h
1
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) {};
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue