From 5a2375e60852ce7814a4a3c304980a5916b088cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bend=C3=ADk?= Date: Sat, 25 Aug 2012 16:41:53 +0200 Subject: [PATCH] Added printing of unknown nodes. --- TileGenerator.cpp | 14 ++++++++++++++ TileGenerator.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/TileGenerator.cpp b/TileGenerator.cpp index 559baed..83a0b01 100644 --- a/TileGenerator.cpp +++ b/TileGenerator.cpp @@ -246,6 +246,7 @@ void TileGenerator::generate(const std::string &input, const std::string &output renderPlayers(input); } writeImage(output); + printUnknown(); } void TileGenerator::openDb(const std::string &input) @@ -468,6 +469,9 @@ inline void TileGenerator::renderMapBlock(const std::string &mapBlock, const Blo m_readedPixels[z] |= (1 << x); m_blockPixelAttributes.attribute(15 - z, xBegin + x).height = pos.y * 16 + y; } + else { + m_unknownNodes.insert(name); + } break; } } @@ -637,6 +641,16 @@ void TileGenerator::writeImage(const std::string &output) gdImageDestroy(m_image); } +void TileGenerator::printUnknown() +{ + if (m_unknownNodes.size() > 0) { + std::cerr << "Unknown nodes:" << std::endl; + for (std::set::iterator node = m_unknownNodes.begin(); node != m_unknownNodes.end(); ++node) { + std::cerr << *node << std::endl; + } + } +} + inline int TileGenerator::getImageX(int val) const { return val + m_border; diff --git a/TileGenerator.h b/TileGenerator.h index 6a5ce29..cedf31a 100644 --- a/TileGenerator.h +++ b/TileGenerator.h @@ -16,6 +16,7 @@ #include #include #include +#include #include "PixelAttributes.h" struct Color { @@ -101,6 +102,7 @@ private: void renderOrigin(); void renderPlayers(const std::string &inputPath); void writeImage(const std::string &output); + void printUnknown(); int getImageX(int val) const; int getImageY(int val) const; @@ -127,6 +129,7 @@ private: std::map m_nameMap; ColorMap m_colors; uint16_t m_readedPixels[16]; + std::set m_unknownNodes; int m_blockAirId; int m_blockIgnoreId;