Add a flag to never output empty images.

This commit is contained in:
Martijn Versteegh
2018-10-31 16:18:29 +01:00
committed by sfan5
parent ac15bacf36
commit ee5b8a9f86
5 changed files with 26 additions and 0 deletions

View File

@ -79,6 +79,7 @@ TileGenerator::TileGenerator():
m_drawScale(false),
m_drawAlpha(false),
m_shading(true),
m_dontWriteEmpty(false),
m_backend(""),
m_xBorder(0),
m_yBorder(0),
@ -228,6 +229,10 @@ void TileGenerator::printGeometry(const std::string &input)
}
void TileGenerator::setDontWriteEmpty(bool f)
{
m_dontWriteEmpty = f;
}
void TileGenerator::generate(const std::string &input, const std::string &output)
{
@ -238,6 +243,13 @@ void TileGenerator::generate(const std::string &input, const std::string &output
openDb(input_path);
loadBlocks();
if (m_dontWriteEmpty && ! m_positions.size())
{
closeDatabase();
return;
}
createImage();
renderMap();
closeDatabase();