diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-01-31 01:04:57 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-01-31 01:04:57 +0100 |
commit | d8aa0b0ec7a2ebea2fc157c623ae8cd7d0b6ba1c (patch) | |
tree | 85a995786a5f01ea108e9cd292173d282f8853d0 /src/Log.cpp | |
parent | Added LOGREPLACELINE for line replacement (diff) | |
download | cuberite-d8aa0b0ec7a2ebea2fc157c623ae8cd7d0b6ba1c.tar cuberite-d8aa0b0ec7a2ebea2fc157c623ae8cd7d0b6ba1c.tar.gz cuberite-d8aa0b0ec7a2ebea2fc157c623ae8cd7d0b6ba1c.tar.bz2 cuberite-d8aa0b0ec7a2ebea2fc157c623ae8cd7d0b6ba1c.tar.lz cuberite-d8aa0b0ec7a2ebea2fc157c623ae8cd7d0b6ba1c.tar.xz cuberite-d8aa0b0ec7a2ebea2fc157c623ae8cd7d0b6ba1c.tar.zst cuberite-d8aa0b0ec7a2ebea2fc157c623ae8cd7d0b6ba1c.zip |
Diffstat (limited to 'src/Log.cpp')
-rw-r--r-- | src/Log.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/Log.cpp b/src/Log.cpp index a23a79ccc..37f1376db 100644 --- a/src/Log.cpp +++ b/src/Log.cpp @@ -134,14 +134,15 @@ void cLog::Log(const char * a_Format, va_list argList, bool a_ReplaceCurrentLine __android_log_print(ANDROID_LOG_ERROR, "MCServer", "%s", Line.c_str() ); //CallJavaFunction_Void_String(g_JavaThread, "AddToLog", Line ); #else + size_t LineLength = Line.length(); + + if (m_LastStringSize == 0) + m_LastStringSize = LineLength; + if (a_ReplaceCurrentLine) { #ifdef _WIN32 - if (m_LastStringSize == 0) - { - m_LastStringSize = Line.length(); - } - else if (Line.length() < m_LastStringSize) // If last printed line was longer than current, clear this line + if (LineLength < m_LastStringSize) // If last printed line was longer than current, clear this line { for (size_t X = 0; X != m_LastStringSize; ++X) { @@ -162,6 +163,9 @@ void cLog::Log(const char * a_Format, va_list argList, bool a_ReplaceCurrentLine { printf("%s", Line.c_str()); } + + m_LastStringSize = LineLength; + #endif #if defined (_WIN32) && defined(_DEBUG) |