mirror of
https://github.com/minetest/minetestmapper.git
synced 2024-12-22 05:52:25 +01:00
Warn if only unknown nodes seen
suggested by @Calinou
This commit is contained in:
parent
e4bf375ac7
commit
31b0d09a19
@ -140,6 +140,7 @@ TileGenerator::TileGenerator():
|
||||
m_geomX2(2048),
|
||||
m_geomY2(2048),
|
||||
m_exhaustiveSearch(EXH_AUTO),
|
||||
m_renderedAny(false),
|
||||
m_zoom(1),
|
||||
m_scales(SCALE_LEFT | SCALE_TOP),
|
||||
m_progressMax(0),
|
||||
@ -542,6 +543,7 @@ void TileGenerator::renderMap()
|
||||
}
|
||||
if (!m_readPixels.full())
|
||||
renderMapBlockBottom(blockStack.begin()->first);
|
||||
m_renderedAny |= m_readInfo.any();
|
||||
};
|
||||
auto postRenderRow = [&] (int16_t zPos) {
|
||||
if (m_shading)
|
||||
@ -847,6 +849,11 @@ void TileGenerator::printUnknown()
|
||||
std::cerr << "Unknown nodes:" << std::endl;
|
||||
for (const auto &node : m_unknownNodes)
|
||||
std::cerr << "\t" << node << std::endl;
|
||||
if (!m_renderedAny) {
|
||||
std::cerr << "The map was read successfully and not empty, but none of the "
|
||||
"encountered nodes had a color associated.\nCheck that you're using "
|
||||
"the right colors.txt. It should match the game you have installed." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void TileGenerator::reportProgress(size_t count)
|
||||
|
@ -43,17 +43,19 @@ struct BitmapThing { // 16x16 bitmap
|
||||
for (int i = 0; i < 16; ++i)
|
||||
val[i] = 0;
|
||||
}
|
||||
inline bool full() const {
|
||||
inline bool any_neq(uint16_t v) const {
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
if (val[i] != 0xffff)
|
||||
return false;
|
||||
if (val[i] != v)
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
inline bool any() const { return any_neq(0); }
|
||||
inline bool full() const { return !any_neq(0xffff); }
|
||||
inline void set(unsigned int x, unsigned int z) {
|
||||
val[z] |= (1 << x);
|
||||
}
|
||||
inline bool get(unsigned int x, unsigned int z) {
|
||||
inline bool get(unsigned int x, unsigned int z) const {
|
||||
return !!(val[z] & (1 << x));
|
||||
}
|
||||
|
||||
@ -148,11 +150,12 @@ private:
|
||||
int m_mapWidth;
|
||||
int m_mapHeight;
|
||||
int m_exhaustiveSearch;
|
||||
std::set<std::string> m_unknownNodes;
|
||||
bool m_renderedAny;
|
||||
std::map<int16_t, std::set<int16_t>> m_positions; /* indexed by Z, contains X coords */
|
||||
ColorMap m_colorMap;
|
||||
BitmapThing m_readPixels;
|
||||
BitmapThing m_readInfo;
|
||||
std::set<std::string> m_unknownNodes;
|
||||
Color m_color[16][16];
|
||||
uint8_t m_thickness[16][16];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user