summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-02-26 01:40:00 +0300
committerAndrei Karas <akaras@inbox.ru>2013-02-26 01:40:00 +0300
commitd4febba47388979b26cd4680cb8a6f20e548e399 (patch)
tree2d520db672ed39b755e668828d27f0dd9d18ed6e /src/resources
parent803b6afd00b0e3574b40b866f21a0d3d01f6dc4d (diff)
downloadplus-d4febba47388979b26cd4680cb8a6f20e548e399.tar.gz
plus-d4febba47388979b26cd4680cb8a6f20e548e399.tar.bz2
plus-d4febba47388979b26cd4680cb8a6f20e548e399.tar.xz
plus-d4febba47388979b26cd4680cb8a6f20e548e399.zip
Improve string usage in other files.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/atlasmanager.cpp6
-rw-r--r--src/resources/dye.cpp2
-rw-r--r--src/resources/emotedb.cpp8
-rw-r--r--src/resources/itemdb.cpp12
-rw-r--r--src/resources/iteminfo.cpp2
-rw-r--r--src/resources/mapdb.cpp2
-rw-r--r--src/resources/mapreader.cpp6
-rw-r--r--src/resources/resourcemanager.cpp28
-rw-r--r--src/resources/spritedef.cpp6
-rw-r--r--src/resources/wallpaper.cpp2
10 files changed, 37 insertions, 37 deletions
diff --git a/src/resources/atlasmanager.cpp b/src/resources/atlasmanager.cpp
index ef36eedac..9ff01b9c4 100644
--- a/src/resources/atlasmanager.cpp
+++ b/src/resources/atlasmanager.cpp
@@ -148,7 +148,8 @@ void AtlasManager::simpleSort(const std::string &name,
Image *img = *it;
if (img)
{
- atlas->name = "atlas_" + name + "_" + img->getIdPath();
+ atlas->name = std::string("atlas_").append(name).append(
+ "_").append(img->getIdPath());
break;
}
}
@@ -175,7 +176,8 @@ void AtlasManager::simpleSort(const std::string &name,
y = 0;
atlases.push_back(atlas);
atlas = new TextureAtlas();
- atlas->name = "atlas_" + name + "_" + img->getIdPath();
+ atlas->name = std::string("atlas_").append(name).append(
+ "_").append(img->getIdPath());
}
if (img->mBounds.h > tempHeight)
diff --git a/src/resources/dye.cpp b/src/resources/dye.cpp
index a92af93bf..202ab0675 100644
--- a/src/resources/dye.cpp
+++ b/src/resources/dye.cpp
@@ -52,7 +52,7 @@ DyePalette::DyePalette(const std::string &description, const int8_t blockSize)
};
for (int i = 0, colorIdx = 0; i < blockSize && colorIdx < 4;
- i +=2, colorIdx ++)
+ i += 2, colorIdx ++)
{
color.value[colorIdx] = static_cast<unsigned char>((
hexDecode(description[pos + i]) << 4)
diff --git a/src/resources/emotedb.cpp b/src/resources/emotedb.cpp
index d352e79c3..7e923c034 100644
--- a/src/resources/emotedb.cpp
+++ b/src/resources/emotedb.cpp
@@ -91,8 +91,8 @@ void EmoteDB::load()
{
EmoteSprite *const currentSprite = new EmoteSprite;
std::string file = paths.getStringValue("sprites")
- + std::string(reinterpret_cast<const char*>(
- spriteNode->xmlChildrenNode->content));
+ .append(std::string(reinterpret_cast<const char*>(
+ spriteNode->xmlChildrenNode->content)));
currentSprite->sprite = AnimatedSprite::load(file,
XML::getProperty(spriteNode, "variant", 0));
currentSprite->name = XML::langProperty(
@@ -147,8 +147,8 @@ void EmoteDB::load()
{
EmoteSprite *const currentSprite = new EmoteSprite;
std::string file = paths.getStringValue("sprites")
- + std::string(reinterpret_cast<const char*>(
- spriteNode->xmlChildrenNode->content));
+ .append(std::string(reinterpret_cast<const char*>(
+ spriteNode->xmlChildrenNode->content)));
currentSprite->sprite = AnimatedSprite::load(file,
XML::getProperty(spriteNode, "variant", 0));
currentSprite->name = XML::langProperty(
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index 5fd0da97b..befcd621e 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -323,8 +323,8 @@ void ItemDB::load()
if (!value)
continue;
if (!effect.empty())
- effect += " / ";
- effect += strprintf(gettext(fields[i][1]), value);
+ effect.append(" / ");
+ effect.append(strprintf(gettext(fields[i][1]), value));
}
FOR_EACH (std::vector<Stat>::const_iterator, it, extraStats)
{
@@ -332,13 +332,13 @@ void ItemDB::load()
if (!value)
continue;
if (!effect.empty())
- effect += " / ";
- effect += strprintf(it->format.c_str(), value);
+ effect.append(" / ");
+ effect.append(strprintf(it->format.c_str(), value));
}
std::string temp = XML::langProperty(node, "effect", "");
if (!effect.empty() && !temp.empty())
- effect += " / ";
- effect += temp;
+ effect.append(" / ");
+ effect.append(temp);
itemInfo->setEffect(effect);
for_each_xml_child_node(itemChild, node)
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index 8033ada7b..04be2fc6f 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -107,7 +107,7 @@ void ItemInfo::setAttackAction(std::string attackAction)
void ItemInfo::addSound(const EquipmentSoundEvent event,
const std::string &filename)
{
- mSounds[event].push_back(paths.getStringValue("sfx") + filename);
+ mSounds[event].push_back(paths.getStringValue("sfx").append(filename));
}
const std::string &ItemInfo::getSound(const EquipmentSoundEvent event) const
diff --git a/src/resources/mapdb.cpp b/src/resources/mapdb.cpp
index 9c0cdce55..0efc07bf6 100644
--- a/src/resources/mapdb.cpp
+++ b/src/resources/mapdb.cpp
@@ -54,7 +54,7 @@ void MapDB::load()
void MapDB::loadRemap()
{
XML::Document *doc = new XML::Document(
- paths.getStringValue("maps") + "remap.xml");
+ paths.getStringValue("maps").append("remap.xml"));
const XmlNodePtr root = doc->rootNode();
if (!root)
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index cd0b68163..ec7651745 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -71,7 +71,7 @@ static std::string resolveRelativePath(std::string base, std::string relative)
// Re-add trailing slash, if needed
if (!base.empty() && base[base.length() - 1] != '/')
- base += '/';
+ base.append("/");
return base + relative;
}
@@ -264,7 +264,7 @@ Map *MapReader::readMap(XmlNodePtr node, const std::string &path)
const bool showWarps = config.getBoolValue("warpParticle");
const std::string warpPath = paths.getStringValue("particles")
- + paths.getStringValue("portalEffectFile");
+ .append(paths.getStringValue("portalEffectFile"));
if (tilew < 0 || tileh < 0)
{
@@ -862,6 +862,6 @@ void MapReader::updateMusic(Map *const map)
const size_t p = name.rfind(".");
if (p != std::string::npos)
name = name.substr(0, p);
- name += ".ogg";
+ name.append(".ogg");
map->setProperty("music", name);
}
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 1d6347d75..7759fdb73 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -80,9 +80,9 @@ ResourceManager::~ResourceManager()
{
if (iter->second->getRefCount())
{
- logger->log("ResourceLeak: " + iter->second->getIdPath()
- + " (" + toString(iter->second->getRefCount())
- + ")");
+ logger->log(std::string("ResourceLeak: ").append(
+ iter->second->getIdPath()).append(" (").append(
+ toString(iter->second->getRefCount())).append(")"));
}
}
++iter;
@@ -237,7 +237,7 @@ void ResourceManager::logResource(const Resource *const res)
std::string src = image->getSource();
const int count = image->getRefCount();
if (count)
- src += " " + toString(count);
+ src.append(" ").append(toString(count));
if (image)
{
logger->log("resource(%s, %u) %s", res->mIdPath.c_str(),
@@ -341,8 +341,7 @@ void ResourceManager::searchAndAddArchives(const std::string &path,
file = path + (*i);
realPath = std::string(PhysFs::getRealDir(file.c_str()));
- archive = realPath + dirSep + file;
-
+ archive = std::string(realPath).append(dirSep).append(file);
addToSearchPath(archive, append);
}
}
@@ -366,8 +365,7 @@ void ResourceManager::searchAndRemoveArchives(const std::string &path,
file = path + (*i);
realPath = std::string(PhysFs::getRealDir(file.c_str()));
- archive = realPath + dirSep + file;
-
+ archive = std::string(realPath).append(dirSep).append(file);
removeFromSearchPath(archive);
}
}
@@ -410,12 +408,13 @@ std::string ResourceManager::getPath(const std::string &file) const
// if the file is not in the search path, then its nullptr
if (tmp)
{
- path = std::string(tmp) + dirSeparator + file;
+ path = std::string(tmp).append(dirSeparator).append(file);
}
else
{
// if not found in search path return the default path
- path = Client::getPackageDirectory() + dirSeparator + file;
+ path = std::string(Client::getPackageDirectory()).append(
+ dirSeparator).append(file);
}
return path;
@@ -878,8 +877,9 @@ void ResourceManager::deleteInstance()
{
if (res->getRefCount())
{
- logger->log("ResourceLeak: " + res->getIdPath()
- + " (" + toString(res->getRefCount()) + ")");
+ logger->log(std::string("ResourceLeak: ").append(
+ res->getIdPath()).append(" (").append(toString(
+ res->getRefCount())).append(")"));
}
}
++iter;
@@ -998,9 +998,7 @@ void ResourceManager::saveTextFile(std::string path, std::string name,
if (!mkdir_r(path.c_str()))
{
std::ofstream file;
- std::string fileName = path + "/" + name;
-
- file.open(fileName.c_str(), std::ios::out);
+ file.open((path.append("/").append(name)).c_str(), std::ios::out);
if (file.is_open())
file << text << std::endl;
file.close();
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index 4af25c8cf..ff9b71901 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -87,8 +87,8 @@ SpriteDef *SpriteDef::load(const std::string &animationFile, const int variant)
{
logger->log("Error, failed to parse %s", animationFile.c_str());
- std::string errorFile = paths.getStringValue("sprites")
- + paths.getStringValue("spriteErrorFile");
+ std::string errorFile = paths.getStringValue("sprites").append(
+ paths.getStringValue("spriteErrorFile"));
if (animationFile != errorFile)
return load(errorFile, 0);
else
@@ -389,7 +389,7 @@ void SpriteDef::includeSprite(const XmlNodePtr includeNode)
if (filename.empty())
return;
- filename = paths.getStringValue("sprites") + filename;
+ filename = paths.getStringValue("sprites").append(filename);
if (mProcessedFiles.find(filename) != mProcessedFiles.end())
{
diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp
index 9c694ece9..4f518f083 100644
--- a/src/resources/wallpaper.cpp
+++ b/src/resources/wallpaper.cpp
@@ -161,7 +161,7 @@ std::string Wallpaper::getWallpaper(const int width, const int height)
// Return the backup file if everything else failed...
if (haveBackup)
- return std::string(wallpaperPath + wallpaperFile);
+ return std::string(wallpaperPath).append(wallpaperFile);
// Return an empty string if everything else failed
return std::string();