Add some verbose log messages that are possibly useful

This commit is contained in:
sfan5 2025-03-05 21:25:40 +01:00
parent 527db7fc34
commit 3c08380d18
3 changed files with 9 additions and 5 deletions

View File

@ -107,8 +107,8 @@ void BlockDecoder::decode(const ustring &datastr)
m_contentWidth = contentWidth; m_contentWidth = contentWidth;
if (version >= 29) { if (version >= 29) {
m_mapData.resize((contentWidth + paramsWidth) * 4096); size_t mapDataSize = (contentWidth + paramsWidth) * 4096;
m_mapData.assign(data + dataOffset, m_mapData.size()); m_mapData.assign(data + dataOffset, mapDataSize);
return; // we have read everything we need and can return early return; // we have read everything we need and can return early
} }

View File

@ -83,7 +83,8 @@ void FilesReader::read(PlayerAttributes::Players &dest)
Player player; Player player;
player.name = name; player.name = name;
if (!parse_pos(position, player)) { if (!parse_pos(position, player)) {
errorstream << "Failed to parse position '" << position << "'" << std::endl; errorstream << "Failed to parse position '" << position << "' in "
<< ent->d_name << std::endl;
continue; continue;
} }
@ -135,6 +136,7 @@ PlayerAttributes::PlayerAttributes(const std::string &worldDir)
std::string backend = read_setting_default("player_backend", ifs, "files"); std::string backend = read_setting_default("player_backend", ifs, "files");
ifs.close(); ifs.close();
verbosestream << "Player backend is " << backend << std::endl;
if (backend == "files") if (backend == "files")
FilesReader(worldDir + "players").read(m_players); FilesReader(worldDir + "players").read(m_players);
else if (backend == "sqlite3") else if (backend == "sqlite3")

View File

@ -105,8 +105,8 @@ static Color parseColor(const std::string &color)
static Color mixColors(Color a, Color b) static Color mixColors(Color a, Color b)
{ {
Color result; Color result;
double a1 = a.a / 255.0; float a1 = a.a / 255.0f;
double a2 = b.a / 255.0; float a2 = b.a / 255.0f;
result.r = (int) (a1 * a.r + a2 * (1 - a1) * b.r); result.r = (int) (a1 * a.r + a2 * (1 - a1) * b.r);
result.g = (int) (a1 * a.g + a2 * (1 - a1) * b.g); result.g = (int) (a1 * a.g + a2 * (1 - a1) * b.g);
@ -303,6 +303,7 @@ void TileGenerator::generate(const std::string &input_path, const std::string &o
// result will be empty. // result will be empty.
if (m_dontWriteEmpty && (m_exhaustiveSearch == EXH_NEVER || if (m_dontWriteEmpty && (m_exhaustiveSearch == EXH_NEVER ||
m_exhaustiveSearch == EXH_Y) && m_positions.empty()) { m_exhaustiveSearch == EXH_Y) && m_positions.empty()) {
verbosestream << "Result is empty (no positions)" << std::endl;
return; return;
} }
@ -310,6 +311,7 @@ void TileGenerator::generate(const std::string &input_path, const std::string &o
renderMap(); renderMap();
if (m_dontWriteEmpty && !m_renderedAny) { if (m_dontWriteEmpty && !m_renderedAny) {
verbosestream << "Result is empty (no pixels)" << std::endl;
printUnknown(); printUnknown();
return; return;
} }