summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-02-02 21:10:23 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-02-02 21:10:23 +0100
commit6ef5c057aa2a36dbd54f56780e5700e753b37bcf (patch)
tree5af1787afe89de7b2221330332fbae63b1c30a30
parentRevert "Added a comment" (diff)
downloadcuberite-6ef5c057aa2a36dbd54f56780e5700e753b37bcf.tar
cuberite-6ef5c057aa2a36dbd54f56780e5700e753b37bcf.tar.gz
cuberite-6ef5c057aa2a36dbd54f56780e5700e753b37bcf.tar.bz2
cuberite-6ef5c057aa2a36dbd54f56780e5700e753b37bcf.tar.lz
cuberite-6ef5c057aa2a36dbd54f56780e5700e753b37bcf.tar.xz
cuberite-6ef5c057aa2a36dbd54f56780e5700e753b37bcf.tar.zst
cuberite-6ef5c057aa2a36dbd54f56780e5700e753b37bcf.zip
-rw-r--r--src/Log.cpp14
-rw-r--r--src/MCLogger.cpp12
-rw-r--r--src/MCLogger.h4
-rw-r--r--src/World.cpp2
4 files changed, 13 insertions, 19 deletions
diff --git a/src/Log.cpp b/src/Log.cpp
index 37f1376db..a23a79ccc 100644
--- a/src/Log.cpp
+++ b/src/Log.cpp
@@ -134,15 +134,14 @@ 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 (LineLength < m_LastStringSize) // If last printed line was longer than current, clear this line
+ 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
{
for (size_t X = 0; X != m_LastStringSize; ++X)
{
@@ -163,9 +162,6 @@ 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)
diff --git a/src/MCLogger.cpp b/src/MCLogger.cpp
index aebe3e1c9..632ea2efe 100644
--- a/src/MCLogger.cpp
+++ b/src/MCLogger.cpp
@@ -11,10 +11,6 @@
cMCLogger * cMCLogger::s_MCLogger = NULL;
bool g_ShouldColorOutput = false;
-/** Flag to show whether a 'replace line' log command has been issued
-Used to decide when to put a newline */
-bool g_BeginLineUpdate = false;
-
#ifdef _WIN32
#include <io.h> // Needed for _isatty(), not available on Linux
@@ -127,14 +123,14 @@ void cMCLogger::Log(const char * a_Format, va_list a_ArgList, bool a_ShouldRepla
{
cCSLock Lock(m_CriticalSection);
- if (!g_BeginLineUpdate && a_ShouldReplaceLine)
+ if (!m_BeginLineUpdate && a_ShouldReplaceLine)
{
a_ShouldReplaceLine = false; // Print a normal line first if this is the initial replace line
- g_BeginLineUpdate = true;
+ m_BeginLineUpdate = true;
}
- else if (g_BeginLineUpdate && !a_ShouldReplaceLine)
+ else if (m_BeginLineUpdate && !a_ShouldReplaceLine)
{
- g_BeginLineUpdate = false;
+ m_BeginLineUpdate = false;
}
if (a_ShouldReplaceLine)
diff --git a/src/MCLogger.h b/src/MCLogger.h
index c105ab6e2..7bcc195dd 100644
--- a/src/MCLogger.h
+++ b/src/MCLogger.h
@@ -51,6 +51,10 @@ private:
/// Common initialization for all constructors, creates a logfile with the specified name and assigns s_MCLogger to this
void InitLog(const AString & a_FileName);
+
+ /** Flag to show whether a 'replace line' log command has been issued
+ Used to decide when to put a newline */
+ bool m_BeginLineUpdate = false;
}; // tolua_export
diff --git a/src/World.cpp b/src/World.cpp
index acfcf8e48..5cd3e1478 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -111,7 +111,6 @@ protected:
cSleep::MilliSleep(100);
if (m_ShouldTerminate)
{
- LOGREPLACELINE("World successfully loaded!");
return;
}
}
@@ -162,7 +161,6 @@ protected:
cSleep::MilliSleep(100);
if (m_ShouldTerminate)
{
- LOGREPLACELINE("Lighting successful!");
return;
}
}