summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-04-03 02:12:42 +0300
committerAndrei Karas <akaras@inbox.ru>2017-04-03 18:44:58 +0300
commit9e72886ee15acc39cbb6075ce32a60a5391ea9f3 (patch)
treefd7d0b05eeaed5ab0016cad58772cab7456f36b4 /src/resources
parent49631972db5b965413d4bbe36983a8d5bd203183 (diff)
downloadmanaverse-9e72886ee15acc39cbb6075ce32a60a5391ea9f3.tar.gz
manaverse-9e72886ee15acc39cbb6075ce32a60a5391ea9f3.tar.bz2
manaverse-9e72886ee15acc39cbb6075ce32a60a5391ea9f3.tar.xz
manaverse-9e72886ee15acc39cbb6075ce32a60a5391ea9f3.zip
Replace string::append with pathJoin.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/db/emotedb.cpp16
-rw-r--r--src/resources/db/horsedb.cpp8
-rw-r--r--src/resources/iteminfo.cpp3
-rw-r--r--src/resources/map/map.cpp8
-rw-r--r--src/resources/mapreader.cpp6
-rw-r--r--src/resources/sprite/spritedef.cpp2
-rw-r--r--src/resources/wallpaper.cpp2
7 files changed, 23 insertions, 22 deletions
diff --git a/src/resources/db/emotedb.cpp b/src/resources/db/emotedb.cpp
index 8fddc0a19..7d9e47e8b 100644
--- a/src/resources/db/emotedb.cpp
+++ b/src/resources/db/emotedb.cpp
@@ -50,8 +50,8 @@ void EmoteDB::load()
unload();
EmoteSprite *const unknownSprite = new EmoteSprite;
- unknownSprite->sprite = AnimatedSprite::load(paths.getStringValue(
- "sprites").append(paths.getStringValue(
+ unknownSprite->sprite = AnimatedSprite::load(pathJoin(paths.getStringValue(
+ "sprites"), paths.getStringValue(
"spriteErrorFile")));
unknownSprite->name = "unknown";
unknownSprite->id = 0;
@@ -126,9 +126,9 @@ void EmoteDB::loadXmlFile(const std::string &fileName,
if (xmlNameEqual(spriteNode, "sprite"))
{
EmoteSprite *const currentSprite = new EmoteSprite;
- currentSprite->sprite = AnimatedSprite::load(
- paths.getStringValue("sprites").append(std::string(
- XmlChildContent(spriteNode))),
+ currentSprite->sprite = AnimatedSprite::load(pathJoin(
+ paths.getStringValue("sprites"),
+ XmlChildContent(spriteNode)),
XML::getProperty(spriteNode, "variant", 0));
currentSprite->name = XML::langProperty(
spriteNode, "name", "");
@@ -199,9 +199,9 @@ void EmoteDB::loadSpecialXmlFile(const std::string &fileName,
if (xmlNameEqual(spriteNode, "sprite"))
{
EmoteSprite *const currentSprite = new EmoteSprite;
- currentSprite->sprite = AnimatedSprite::load(
- paths.getStringValue("sprites").append(std::string(
- XmlChildContent(spriteNode))),
+ currentSprite->sprite = AnimatedSprite::load(pathJoin(
+ paths.getStringValue("sprites"),
+ XmlChildContent(spriteNode)),
XML::getProperty(spriteNode, "variant", 0));
currentSprite->name = XML::langProperty(
spriteNode, "name", "");
diff --git a/src/resources/db/horsedb.cpp b/src/resources/db/horsedb.cpp
index 1eab6ada7..a6b395d3f 100644
--- a/src/resources/db/horsedb.cpp
+++ b/src/resources/db/horsedb.cpp
@@ -43,8 +43,8 @@ namespace
#define loadSprite(name) \
{ \
SpriteReference *const currentSprite = new SpriteReference; \
- currentSprite->sprite = paths.getStringValue("sprites").append( \
- std::string(XmlChildContent(spriteNode))); \
+ currentSprite->sprite = pathJoin(paths.getStringValue("sprites"), \
+ XmlChildContent(spriteNode)); \
currentSprite->variant = XML::getProperty( \
spriteNode, "variant", 0); \
currentInfo->name.push_back(currentSprite); \
@@ -62,13 +62,13 @@ void HorseDB::load()
unload();
SpriteReference *currentSprite = new SpriteReference;
- currentSprite->sprite = paths.getStringValue("sprites").append(
+ currentSprite->sprite = pathJoin(paths.getStringValue("sprites"),
paths.getStringValue("spriteErrorFile"));
currentSprite->variant = 0;
mUnknown.downSprites.push_back(currentSprite);
currentSprite = new SpriteReference;
- currentSprite->sprite = paths.getStringValue("sprites").append(
+ currentSprite->sprite = pathJoin(paths.getStringValue("sprites"),
paths.getStringValue("spriteErrorFile"));
currentSprite->variant = 0;
mUnknown.upSprites.push_back(currentSprite);
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index 6c0363e6c..75e166a0d 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -152,7 +152,8 @@ void ItemInfo::addSound(const ItemSoundEvent::Type event,
const std::string &filename, const int delay)
{
mSounds[event].push_back(SoundInfo(
- paths.getStringValue("sfx").append(filename), delay));
+ pathJoin(paths.getStringValue("sfx"), filename),
+ delay));
}
const SoundInfo &ItemInfo::getSound(const ItemSoundEvent::Type event) const
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp
index b7e5d1fca..c24e3752e 100644
--- a/src/resources/map/map.cpp
+++ b/src/resources/map/map.cpp
@@ -1135,8 +1135,8 @@ void Map::addExtraLayer() restrict2
BLOCK_END("Map::addExtraLayer")
return;
}
- const std::string mapFileName = getUserMapDirectory().append(
- "/extralayer.txt");
+ const std::string mapFileName = pathJoin(getUserMapDirectory(),
+ "extralayer.txt");
logger->log("loading extra layer: " + mapFileName);
struct stat statbuf;
if (!stat(mapFileName.c_str(), &statbuf) && S_ISREG(statbuf.st_mode))
@@ -1208,8 +1208,8 @@ void Map::saveExtraLayer() const restrict2
logger->log1("No special layer");
return;
}
- const std::string mapFileName = getUserMapDirectory().append(
- "/extralayer.txt");
+ const std::string mapFileName = pathJoin(getUserMapDirectory(),
+ "extralayer.txt");
logger->log("saving extra layer: " + mapFileName);
if (mkdir_r(getUserMapDirectory().c_str()))
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 307364457..84dff3140 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -337,8 +337,8 @@ Map *MapReader::readMap(XmlNodePtrConst node, const std::string &path)
const int tileh = XML::getProperty(node, "tileheight", -1);
const bool showWarps = config.getBoolValue("warpParticle");
- const std::string warpPath = paths.getStringValue("particles")
- .append(paths.getStringValue("portalEffectFile"));
+ const std::string warpPath = pathJoin(paths.getStringValue("particles"),
+ paths.getStringValue("portalEffectFile"));
if (tilew < 0 || tileh < 0)
{
@@ -1280,7 +1280,7 @@ void MapReader::updateMusic(Map *const map)
if (p != std::string::npos)
name = name.substr(0, p);
name.append(".ogg");
- if (VirtFs::exists(paths.getStringValue("music").append(name)))
+ if (VirtFs::exists(pathJoin(paths.getStringValue("music"), name)))
map->setProperty("music", name);
}
diff --git a/src/resources/sprite/spritedef.cpp b/src/resources/sprite/spritedef.cpp
index 59ac9d9f4..2b79c3806 100644
--- a/src/resources/sprite/spritedef.cpp
+++ b/src/resources/sprite/spritedef.cpp
@@ -105,7 +105,7 @@ SpriteDef *SpriteDef::load(const std::string &animationFile,
{
reportAlways("Error, failed to parse sprite %s",
animationFile.c_str());
- const std::string errorFile = paths.getStringValue("sprites").append(
+ const std::string errorFile = pathJoin(paths.getStringValue("sprites"),
paths.getStringValue("spriteErrorFile"));
BLOCK_END("SpriteDef::load")
doc->decRef();
diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp
index 79cb6bbbd..9b12946d4 100644
--- a/src/resources/wallpaper.cpp
+++ b/src/resources/wallpaper.cpp
@@ -156,7 +156,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).append(wallpaperFile);
+ return pathJoin(wallpaperPath, wallpaperFile);
// Return an empty string if everything else failed
return std::string();