Skip to content

Commit 5a2375e

Browse files
committed
Added printing of unknown nodes.
1 parent ae08fb7 commit 5a2375e

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

TileGenerator.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ void TileGenerator::generate(const std::string &input, const std::string &output
246246
renderPlayers(input);
247247
}
248248
writeImage(output);
249+
printUnknown();
249250
}
250251

251252
void TileGenerator::openDb(const std::string &input)
@@ -468,6 +469,9 @@ inline void TileGenerator::renderMapBlock(const std::string &mapBlock, const Blo
468469
m_readedPixels[z] |= (1 << x);
469470
m_blockPixelAttributes.attribute(15 - z, xBegin + x).height = pos.y * 16 + y;
470471
}
472+
else {
473+
m_unknownNodes.insert(name);
474+
}
471475
break;
472476
}
473477
}
@@ -637,6 +641,16 @@ void TileGenerator::writeImage(const std::string &output)
637641
gdImageDestroy(m_image);
638642
}
639643

644+
void TileGenerator::printUnknown()
645+
{
646+
if (m_unknownNodes.size() > 0) {
647+
std::cerr << "Unknown nodes:" << std::endl;
648+
for (std::set<std::string>::iterator node = m_unknownNodes.begin(); node != m_unknownNodes.end(); ++node) {
649+
std::cerr << *node << std::endl;
650+
}
651+
}
652+
}
653+
640654
inline int TileGenerator::getImageX(int val) const
641655
{
642656
return val + m_border;

TileGenerator.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <sqlite3.h>
1717
#include <stdint.h>
1818
#include <string>
19+
#include <set>
1920
#include "PixelAttributes.h"
2021

2122
struct Color {
@@ -101,6 +102,7 @@ class TileGenerator
101102
void renderOrigin();
102103
void renderPlayers(const std::string &inputPath);
103104
void writeImage(const std::string &output);
105+
void printUnknown();
104106
int getImageX(int val) const;
105107
int getImageY(int val) const;
106108

@@ -127,6 +129,7 @@ class TileGenerator
127129
std::map<int, std::string> m_nameMap;
128130
ColorMap m_colors;
129131
uint16_t m_readedPixels[16];
132+
std::set<std::string> m_unknownNodes;
130133

131134
int m_blockAirId;
132135
int m_blockIgnoreId;

0 commit comments

Comments
 (0)