]> git.lizzy.rs Git - minetest.git/blobdiff - src/terminal_chat_console.cpp
Use native packer to transfer globals into async env(s)
[minetest.git] / src / terminal_chat_console.cpp
index a8c4ebaef1a8926e559f06ae534567b46fe8c3f1..b12261c3b8bac71e3c0fb37690ed8756d3495ea1 100644 (file)
@@ -17,6 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
+#include <inttypes.h>
 #include "config.h"
 #if USE_CURSES
 #include "version.h"
@@ -25,6 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "settings.h"
 #include "util/numeric.h"
 #include "util/string.h"
+#include "chat_interface.h"
 
 TerminalChatConsole g_term_console;
 
@@ -347,7 +349,8 @@ void TerminalChatConsole::step(int ch)
 
                std::wstring error_message = utf8_to_wide(Logger::getLevelLabel(p.first));
                if (!g_settings->getBool("disable_escape_sequences")) {
-                       error_message = L"\x1b(c@red)" + error_message + L"\x1b(c@white)";
+                       error_message = std::wstring(L"\x1b(c@red)").append(error_message)
+                               .append(L"\x1b(c@white)");
                }
                m_chat_backend.addMessage(error_message, utf8_to_wide(p.second));
        }
@@ -396,7 +399,7 @@ void TerminalChatConsole::step(int ch)
        minutes = (float)minutes / 1000 * 60;
 
        if (m_game_time)
-               printw(" | Game %d Time of day %02d:%02d ",
+               printw(" | Game %" PRIu64 " Time of day %02d:%02d ",
                        m_game_time, hours, minutes);
 
        // draw text
@@ -438,8 +441,7 @@ void TerminalChatConsole::draw_text()
                const ChatFormattedLine& line = buf.getFormattedLine(row);
                if (line.fragments.empty())
                        continue;
-               for (u32 i = 0; i < line.fragments.size(); ++i) {
-                       const ChatFormattedFragment& fragment = line.fragments[i];
+               for (const ChatFormattedFragment &fragment : line.fragments) {
                        addstr(wide_to_utf8(fragment.text.getString()).c_str());
                }
        }