summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-11-24 20:58:18 +0300
committerAndrei Karas <akaras@inbox.ru>2014-11-24 20:58:18 +0300
commit75c5b3d32afdb34b824daafaa6d4300b9a8ec06b (patch)
treecd40cd214fd3f590ec7af6f4ca5c627d4ffed068 /src
parent280e7f9dcf757bed0bf652cee1a1485c695cc757 (diff)
downloadmanaplus-75c5b3d32afdb34b824daafaa6d4300b9a8ec06b.tar.gz
manaplus-75c5b3d32afdb34b824daafaa6d4300b9a8ec06b.tar.bz2
manaplus-75c5b3d32afdb34b824daafaa6d4300b9a8ec06b.tar.xz
manaplus-75c5b3d32afdb34b824daafaa6d4300b9a8ec06b.zip
Add option to disable logging for better performance while connected to server.
Diffstat (limited to 'src')
-rw-r--r--src/defaults.cpp1
-rw-r--r--src/game.cpp3
-rw-r--r--src/gui/widgets/tabs/setup_perfomance.cpp9
-rw-r--r--src/logger.cpp11
-rw-r--r--src/settings.h4
5 files changed, 26 insertions, 2 deletions
diff --git a/src/defaults.cpp b/src/defaults.cpp
index a383c02f6..81b1abff1 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -369,6 +369,7 @@ DefaultsData* getConfigDefaults()
AddDEF("showserverpos", false);
AddDEF("textureSize", "1024,1024,1024,1024,1024,1024");
AddDEF("ignorelogpackets", "");
+ AddDEF("disableLoggingInGame", false);
return configData;
}
diff --git a/src/game.cpp b/src/game.cpp
index 0451dd516..675667cf0 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -409,10 +409,13 @@ Game::Game() :
if (localPlayer)
localPlayer->updatePets();
+
+ settings.disableLoggingInGame = config.getBoolValue("disableLoggingInGame");
}
Game::~Game()
{
+ settings.disableLoggingInGame = false;
touchManager.setInGame(false);
config.write();
serverConfig.write();
diff --git a/src/gui/widgets/tabs/setup_perfomance.cpp b/src/gui/widgets/tabs/setup_perfomance.cpp
index 247419f7b..a6a8d80c0 100644
--- a/src/gui/widgets/tabs/setup_perfomance.cpp
+++ b/src/gui/widgets/tabs/setup_perfomance.cpp
@@ -129,7 +129,6 @@ Setup_Perfomance::Setup_Perfomance(const Widget2 *const widget) :
new SetupItemLabel(_("Different options (enable or disable can "
"improve performance)"), "", this);
-
mTexturesList->fillFromArray(&texturesList[0], texturesListSize);
// TRANSLATORS: settings option
new SetupItemDropDown(_("Enable texture compression (OpenGL)"), "",
@@ -157,6 +156,14 @@ Setup_Perfomance::Setup_Perfomance(const Widget2 *const widget) :
"", "uselonglivesounds", this,
"uselonglivesoundsEvent");
+ // TRANSLATORS: settings group
+ new SetupItemLabel(_("Critical options (DO NOT change if you don't "
+ "know what it duing)"), "", this);
+
+ // TRANSLATORS: settings option
+ new SetupItemCheckBox(_("Disable logging in game (do not enable)"),
+ "", "disableLoggingInGame", this, "disableLoggingInGameEvent");
+
setDimension(Rect(0, 0, 550, 350));
}
diff --git a/src/logger.cpp b/src/logger.cpp
index 2b80602e8..5a3efb0ee 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -22,6 +22,8 @@
#include "logger.h"
+#include "settings.h"
+
#include <iostream>
#include <sstream>
@@ -180,6 +182,9 @@ void Logger::dlog2(const std::string &str,
void Logger::log1(const char *const buf)
{
+ if (settings.disableLoggingInGame)
+ return;
+
// Get the current system time
timeval tv;
gettimeofday(&tv, nullptr);
@@ -198,6 +203,9 @@ void Logger::log1(const char *const buf)
void Logger::log(const char *const log_text, ...)
{
+ if (settings.disableLoggingInGame)
+ return;
+
unsigned size = 1024;
if (strlen(log_text) * 3 > size)
size = static_cast<unsigned>(strlen(log_text) * 3);
@@ -232,6 +240,9 @@ void Logger::log(const char *const log_text, ...)
void Logger::log_r(const char *const log_text, ...)
{
+ if (settings.disableLoggingInGame)
+ return;
+
SDL_mutexP(mMutex);
unsigned size = 1024;
diff --git a/src/settings.h b/src/settings.h
index 1362672aa..f344f9f15 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -74,7 +74,8 @@ class Settings final
disableGameModifiers(false),
awayMode(false),
pseudoAwayMode(false),
- fixDeadAnimation(true)
+ fixDeadAnimation(true),
+ disableLoggingInGame(false)
{ }
std::string updateHost;
@@ -118,6 +119,7 @@ class Settings final
bool awayMode;
bool pseudoAwayMode;
bool fixDeadAnimation;
+ bool disableLoggingInGame;
};
extern Settings settings;