Added printing of unknown nodes.

This commit is contained in:
Miroslav Bendík 2012-08-25 16:41:53 +02:00
parent ae08fb7345
commit 5a2375e608
2 changed files with 17 additions and 0 deletions

@ -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<std::string>::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;

@ -16,6 +16,7 @@
#include <sqlite3.h>
#include <stdint.h>
#include <string>
#include <set>
#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<int, std::string> m_nameMap;
ColorMap m_colors;
uint16_t m_readedPixels[16];
std::set<std::string> m_unknownNodes;
int m_blockAirId;
int m_blockIgnoreId;