summaryrefslogtreecommitdiff
path: root/src/gui/userpalette.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-05-27 23:38:09 +0300
committerAndrei Karas <akaras@inbox.ru>2013-05-27 23:38:09 +0300
commitd432d78ba8ced0118cc7aa2be8a0308831932bcb (patch)
tree13cee79cfad7424ecdeeb5745f90edd2d98d8962 /src/gui/userpalette.cpp
parent815c8c567f4aa7271069e37b1d82678920799484 (diff)
downloadmanaverse-d432d78ba8ced0118cc7aa2be8a0308831932bcb.tar.gz
manaverse-d432d78ba8ced0118cc7aa2be8a0308831932bcb.tar.bz2
manaverse-d432d78ba8ced0118cc7aa2be8a0308831932bcb.tar.xz
manaverse-d432d78ba8ced0118cc7aa2be8a0308831932bcb.zip
improve userpalette.
Diffstat (limited to 'src/gui/userpalette.cpp')
-rw-r--r--src/gui/userpalette.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/gui/userpalette.cpp b/src/gui/userpalette.cpp
index fd02a7c77..9db32677a 100644
--- a/src/gui/userpalette.cpp
+++ b/src/gui/userpalette.cpp
@@ -81,7 +81,6 @@ const std::string ColorTypeNames[] =
std::string UserPalette::getConfigName(const std::string &typeName)
{
std::string res = "Color" + typeName;
-
size_t pos = 5;
for (size_t i = 0; i < typeName.length(); i++)
{
@@ -99,7 +98,6 @@ std::string UserPalette::getConfigName(const std::string &typeName)
pos ++;
}
res.erase(pos, res.length() - pos);
-
return res;
}
@@ -252,7 +250,8 @@ void UserPalette::setGradient(const int type, const GradientType grad)
if (elem->grad != STATIC && grad == STATIC)
{
- for (size_t i = 0; i < mGradVector.size(); i++)
+ const int sz = mGradVector.size();
+ for (size_t i = 0; i < sz; i++)
{
if (mGradVector[i] == elem)
{
@@ -337,8 +336,8 @@ void UserPalette::addColor(const unsigned type, const unsigned rgb,
snprintf(buffer, sizeof(buffer), "0x%06x", rgb);
buffer[19] = 0;
- const std::string rgbString = config.getValue(configName,
- std::string(buffer));
+ const std::string rgbString = config.getValue(
+ configName, std::string(buffer));
unsigned int rgbValue = 0;
if (rgbString.length() == 8 && rgbString[0] == '0' && rgbString[1] == 'x')
rgbValue = atox(rgbString);