summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-05-19 18:54:56 +0300
committerAndrei Karas <akaras@inbox.ru>2012-05-19 18:54:56 +0300
commitfe6c2a585a7ba59582723b2fef827dd15bbc8f22 (patch)
treed2e1c9015084f4d99474babd00df0d8974eea498 /src
parent804154afbee8843dde358837ec18ab7bfb785088 (diff)
downloadmanaverse-fe6c2a585a7ba59582723b2fef827dd15bbc8f22.tar.gz
manaverse-fe6c2a585a7ba59582723b2fef827dd15bbc8f22.tar.bz2
manaverse-fe6c2a585a7ba59582723b2fef827dd15bbc8f22.tar.xz
manaverse-fe6c2a585a7ba59582723b2fef827dd15bbc8f22.zip
Fix code style.
Diffstat (limited to 'src')
-rw-r--r--src/client.cpp31
-rw-r--r--src/graphicsmanager.cpp11
-rw-r--r--src/utils/paths.cpp4
-rw-r--r--src/utils/paths.h2
4 files changed, 23 insertions, 25 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 18740cfd5..89e3f6ecf 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -2012,26 +2012,25 @@ void Client::storeSafeParameters()
width = config.getIntValue("screenwidth");
height = config.getIntValue("screenheight");
+ tmpHwaccel = config.getBoolValue("hwaccel");
- if (!mOptions.safeMode && !tmpOpengl)
- {
- tmpHwaccel = config.getBoolValue("hwaccel");
-
- tmpFpslimit = config.getIntValue("fpslimit");
- tmpAltFpslimit = config.getIntValue("altfpslimit");
- tmpSound = config.getBoolValue("sound");
+ tmpFpslimit = config.getIntValue("fpslimit");
+ tmpAltFpslimit = config.getIntValue("altfpslimit");
+ tmpSound = config.getBoolValue("sound");
- font = config.getStringValue("font");
- bFont = config.getStringValue("boldFont");
- particleFont = config.getStringValue("particleFont");
- helpFont = config.getStringValue("helpFont");
- secureFont = config.getStringValue("secureFont");
- japanFont = config.getStringValue("japanFont");
+ font = config.getStringValue("font");
+ bFont = config.getStringValue("boldFont");
+ particleFont = config.getStringValue("particleFont");
+ helpFont = config.getStringValue("helpFont");
+ secureFont = config.getStringValue("secureFont");
+ japanFont = config.getStringValue("japanFont");
- showBackground = config.getBoolValue("showBackground");
- enableMumble = config.getBoolValue("enableMumble");
- enableMapReduce = config.getBoolValue("enableMapReduce");
+ showBackground = config.getBoolValue("showBackground");
+ enableMumble = config.getBoolValue("enableMumble");
+ enableMapReduce = config.getBoolValue("enableMapReduce");
+ if (!mOptions.safeMode && !tmpOpengl)
+ {
// if video mode configured reset most settings to safe
config.setValue("hwaccel", false);
config.setValue("opengl", 0);
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index e9360d88c..f1e13b74b 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -20,7 +20,6 @@
#include "graphicsmanager.h"
-#include "client.h"
#include "configuration.h"
#include "graphics.h"
#include "graphicsvertexes.h"
@@ -29,7 +28,6 @@
#include "resources/image.h"
#include "utils/paths.h"
-#include "utils/process.h"
#include "utils/stringutils.h"
#include "test/testmain.h"
@@ -38,7 +36,9 @@
GraphicsManager graphicsManager;
-GraphicsManager::GraphicsManager()
+GraphicsManager::GraphicsManager() :
+ mMinor(0),
+ mMajor(0)
{
}
@@ -48,7 +48,6 @@ GraphicsManager::~GraphicsManager()
bool GraphicsManager::startDetection()
{
- std::string fileName = getSelfName();
TestMain *test = new TestMain();
test->exec(false);
return test->getConfig().getValueInt("opengl", -1);
@@ -67,13 +66,13 @@ bool GraphicsManager::detectGraphics()
logger->log("gl vendor: %s", vendor.c_str());
logger->log("gl renderer: %s", renderer.c_str());
logger->log("gl version: %s", version.c_str());
- sscanf(version.c_str(), "%d.%d", &mMajor, &mMinor);
+ sscanf(version.c_str(), "%5d.%5d", &mMajor, &mMinor);
char const *glExtensions = reinterpret_cast<char const *>(
glGetString(GL_EXTENSIONS));
updateExtensions(glExtensions);
- bool mode = 1;
+ int mode = 1;
// detecting features by known renderers or vendors
if (findI(renderer, "gdi generic") != std::string::npos)
diff --git a/src/utils/paths.cpp b/src/utils/paths.cpp
index c00a3f39d..228276efd 100644
--- a/src/utils/paths.cpp
+++ b/src/utils/paths.cpp
@@ -85,9 +85,7 @@ std::string removeLast(std::string str)
if (pos2 == std::string::npos || pos3 > pos2)
pos2 = pos3;
}
- if (pos2 == std::string::npos)
- pos2 = -1;
- if (pos2 >= 0)
+ if (pos2 != std::string::npos)
return str.substr(0, pos2);
else
return str;
diff --git a/src/utils/paths.h b/src/utils/paths.h
index 18fa4629e..ba87ab961 100644
--- a/src/utils/paths.h
+++ b/src/utils/paths.h
@@ -31,6 +31,8 @@ bool checkPath(std::string path);
std::string &fixDirSeparators(std::string &str);
+std::string removeLast(std::string str);
+
std::string getSelfName();
#endif // UTILS_PATHS_H