From 3c08380d18ce36b40c66f0538ce6215fa2476af9 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Wed, 5 Mar 2025 21:25:40 +0100 Subject: [PATCH] Add some verbose log messages that are possibly useful --- src/BlockDecoder.cpp | 4 ++-- src/PlayerAttributes.cpp | 4 +++- src/TileGenerator.cpp | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/BlockDecoder.cpp b/src/BlockDecoder.cpp index 240af17..8f9767c 100644 --- a/src/BlockDecoder.cpp +++ b/src/BlockDecoder.cpp @@ -107,8 +107,8 @@ void BlockDecoder::decode(const ustring &datastr) m_contentWidth = contentWidth; if (version >= 29) { - m_mapData.resize((contentWidth + paramsWidth) * 4096); - m_mapData.assign(data + dataOffset, m_mapData.size()); + size_t mapDataSize = (contentWidth + paramsWidth) * 4096; + m_mapData.assign(data + dataOffset, mapDataSize); return; // we have read everything we need and can return early } diff --git a/src/PlayerAttributes.cpp b/src/PlayerAttributes.cpp index 0ce641e..fad9781 100644 --- a/src/PlayerAttributes.cpp +++ b/src/PlayerAttributes.cpp @@ -83,7 +83,8 @@ void FilesReader::read(PlayerAttributes::Players &dest) Player player; player.name = name; 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; } @@ -135,6 +136,7 @@ PlayerAttributes::PlayerAttributes(const std::string &worldDir) std::string backend = read_setting_default("player_backend", ifs, "files"); ifs.close(); + verbosestream << "Player backend is " << backend << std::endl; if (backend == "files") FilesReader(worldDir + "players").read(m_players); else if (backend == "sqlite3") diff --git a/src/TileGenerator.cpp b/src/TileGenerator.cpp index d2fa610..3af9b63 100644 --- a/src/TileGenerator.cpp +++ b/src/TileGenerator.cpp @@ -105,8 +105,8 @@ static Color parseColor(const std::string &color) static Color mixColors(Color a, Color b) { Color result; - double a1 = a.a / 255.0; - double a2 = b.a / 255.0; + float a1 = a.a / 255.0f; + float a2 = b.a / 255.0f; result.r = (int) (a1 * a.r + a2 * (1 - a1) * b.r); 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. if (m_dontWriteEmpty && (m_exhaustiveSearch == EXH_NEVER || m_exhaustiveSearch == EXH_Y) && m_positions.empty()) { + verbosestream << "Result is empty (no positions)" << std::endl; return; } @@ -310,6 +311,7 @@ void TileGenerator::generate(const std::string &input_path, const std::string &o renderMap(); if (m_dontWriteEmpty && !m_renderedAny) { + verbosestream << "Result is empty (no pixels)" << std::endl; printUnknown(); return; }