summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/actorsprite.cpp16
-rw-r--r--src/actorspritemanager.cpp2
-rw-r--r--src/client.cpp39
-rw-r--r--src/configuration.cpp15
-rw-r--r--src/game.cpp10
-rw-r--r--src/graphicsmanager.cpp51
-rw-r--r--src/item.cpp9
-rw-r--r--src/localplayer.cpp4
-rw-r--r--src/logger.cpp3
-rw-r--r--src/spellmanager.cpp4
10 files changed, 83 insertions, 70 deletions
diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp
index 96afb94c7..ac2d6bf7b 100644
--- a/src/actorsprite.cpp
+++ b/src/actorsprite.cpp
@@ -333,8 +333,8 @@ void ActorSprite::setupSpriteDisplay(const SpriteDisplay &display,
{
if (!*it)
continue;
- const std::string file = paths.getStringValue("sprites")
- + combineDye2((*it)->sprite, color);
+ const std::string file = paths.getStringValue("sprites").append(
+ combineDye2((*it)->sprite, color));
const int variant = (*it)->variant;
addSprite(AnimatedSprite::delayedLoad(file, variant));
@@ -346,8 +346,8 @@ void ActorSprite::setupSpriteDisplay(const SpriteDisplay &display,
if (display.image.empty())
{
addSprite(AnimatedSprite::delayedLoad(
- paths.getStringValue("sprites")
- + paths.getStringValue("spriteErrorFile")));
+ paths.getStringValue("sprites").append(
+ paths.getStringValue("spriteErrorFile"))));
}
else
{
@@ -357,12 +357,12 @@ void ActorSprite::setupSpriteDisplay(const SpriteDisplay &display,
{
case 0:
default:
- imagePath = paths.getStringValue("itemIcons")
- + display.image;
+ imagePath = paths.getStringValue("itemIcons").append(
+ display.image);
break;
case 1:
- imagePath = paths.getStringValue("itemIcons")
- + display.floor;
+ imagePath = paths.getStringValue("itemIcons").append(
+ display.floor);
break;
}
imagePath = combineDye2(imagePath, color);
diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp
index 899f51088..ce54316fd 100644
--- a/src/actorspritemanager.cpp
+++ b/src/actorspritemanager.cpp
@@ -1402,7 +1402,7 @@ void ActorSpriteManager::updatePlayerGuild() const
void ActorSpriteManager::parseLevels(std::string levels) const
{
- levels += ", ";
+ levels.append(", ");
size_t f = 0;
const std::string brkEnd = "), ";
size_t pos = levels.find(brkEnd, f);
diff --git a/src/client.cpp b/src/client.cpp
index 66e2e75f6..7493257fd 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -317,7 +317,7 @@ void Client::gameInit()
if (!mOptions.logFileName.empty())
logger->setLogFile(mOptions.logFileName);
else
- logger->setLogFile(mLocalDataDir + std::string("/manaplus.log"));
+ logger->setLogFile(mLocalDataDir + "/manaplus.log");
initConfiguration();
logger->log("init 4");
@@ -344,15 +344,15 @@ void Client::gameInit()
}
#ifdef ANDROID
bindTextDomain("manaplus", (std::string(PhysFs::getBaseDir())
- + "/locale").c_str());
+ .append("/locale")).c_str());
#else
#ifdef ENABLE_PORTABLE
bindTextDomain("manaplus", (std::string(PhysFs::getBaseDir())
- + "../locale/").c_str());
+ .append("../locale/")).c_str());
#else
#ifdef __APPLE__
bindTextDomain("manaplus", (std::string(PhysFs::getBaseDir())
- + "ManaPlus.app/Contents/Resources/locale/").c_str());
+ .append("ManaPlus.app/Contents/Resources/locale/")).c_str());
#else
bindTextDomain("manaplus", LOCALEDIR);
#endif
@@ -480,7 +480,10 @@ void Client::gameInit()
const int loc = static_cast<int>(path.find_last_of('/'));
#endif
if (loc > 0)
- resman->addToSearchPath(path.substr(0, loc + 1) + "data", false);
+ {
+ resman->addToSearchPath(path.substr(
+ 0, loc + 1).append("data"), false);
+ }
}
if (mOptions.dataPath.empty()
@@ -492,7 +495,7 @@ void Client::gameInit()
}
else
{
- mOptions.dataPath = branding.getDirectory() + dirSeparator
+ mOptions.dataPath = branding.getDirectory().append(dirSeparator)
+ branding.getStringValue("dataPath");
}
mOptions.skipUpdate = true;
@@ -508,9 +511,9 @@ void Client::gameInit()
std::string iconFile = branding.getValue("appIcon", "icons/manaplus");
#ifdef WIN32
- iconFile += ".ico";
+ iconFile.append(".ico");
#else
- iconFile += ".png";
+ iconFile.append(".png");
#endif
iconFile = resman->getPath(iconFile);
logger->log("Loading icon from file: %s", iconFile.c_str());
@@ -1836,7 +1839,7 @@ void Client::initLocalDataDir()
mLocalDataDir = getSpecialFolderLocation(CSIDL_LOCAL_APPDATA);
if (mLocalDataDir.empty())
mLocalDataDir = std::string(PhysFs::getUserDir());
- mLocalDataDir += "/Mana";
+ mLocalDataDir.append("/Mana");
#elif defined __ANDROID__
mLocalDataDir = getenv("DATADIR2") + branding.getValue(
"appShort", "ManaPlus") + "/local";
@@ -1883,15 +1886,20 @@ void Client::initConfigDir()
#elif defined WIN32
mConfigDir = getSpecialFolderLocation(CSIDL_APPDATA);
if (mConfigDir.empty())
+ {
mConfigDir = mLocalDataDir;
+ }
else
- mConfigDir += "/mana/" + branding.getValue("appShort", "mana");
+ {
+ mConfigDir.append("/mana/").append(branding.getValue(
+ "appShort", "mana"));
+ }
#elif defined __ANDROID__
mConfigDir = getenv("DATADIR2") + branding.getValue(
- "appShort", "ManaPlus") + "/config";
+ "appShort", "ManaPlus").append("/config");
#else
- mConfigDir = std::string(PhysFs::getUserDir()) +
- "/.config/mana/" + branding.getValue("appShort", "mana");
+ mConfigDir = std::string(PhysFs::getUserDir()).append(
+ "/.config/mana/").append(branding.getValue("appShort", "mana"));
#endif
logger->log("Generating config dir: " + mConfigDir);
}
@@ -2149,7 +2157,10 @@ void Client::initScreenshotDir()
branding.getValue("appShort", "mana");
if (!configScreenshotSuffix.empty())
- mScreenshotDir += dirSeparator + configScreenshotSuffix;
+ {
+ mScreenshotDir.append(dirSeparator).append(
+ configScreenshotSuffix);
+ }
}
}
}
diff --git a/src/configuration.cpp b/src/configuration.cpp
index 2a8e4ecf5..fa0d1dc18 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -822,13 +822,14 @@ void Configuration::removeOldKeys()
}
for (f = 0; f < 80; f ++)
{
- deleteKey("Outfit" + toString(f));
- deleteKey("OutfitUnequip" + toString(f));
- deleteKey("commandShortcutCmd" + toString(f));
- deleteKey("commandShortcutFlags" + toString(f));
- deleteKey("commandShortcutSymbol" + toString(f));
- deleteKey("drop" + toString(f));
- deleteKey("shortcut" + toString(f));
+ const std::string str = toString(f);
+ deleteKey("Outfit" + str);
+ deleteKey("OutfitUnequip" + str);
+ deleteKey("commandShortcutCmd" + str);
+ deleteKey("commandShortcutFlags" + str);
+ deleteKey("commandShortcutSymbol" + str);
+ deleteKey("drop" + str);
+ deleteKey("shortcut" + str);
}
}
}
diff --git a/src/game.cpp b/src/game.cpp
index 2112b4e27..eb1d573e6 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -1008,14 +1008,14 @@ void Game::changeMap(const std::string &mapPath)
mMapName = mapPath;
- std::string fullMap = paths.getValue("maps", "maps/")
- + mMapName + ".tmx";
- std::string realFullMap = paths.getValue("maps", "maps/")
- + MapDB::getMapName(mMapName) + ".tmx";
+ std::string fullMap = paths.getValue("maps", "maps/").append(
+ mMapName).append(".tmx");
+ std::string realFullMap = paths.getValue("maps", "maps/").append(
+ MapDB::getMapName(mMapName)).append(".tmx");
const ResourceManager *const resman = ResourceManager::getInstance();
if (!resman->exists(realFullMap))
- realFullMap += ".gz";
+ realFullMap.append(".gz");
// Attempt to load the new map
Map *const newMap = MapReader::readMap(fullMap, realFullMap);
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index f42aca9cb..92b481534 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -368,8 +368,8 @@ bool GraphicsManager::getAllVideoModes(StringVect &modeList)
for (int i = 0; modes[i]; ++ i)
{
const std::string modeString =
- toString(static_cast<int>(modes[i]->w)) + "x"
- + toString(static_cast<int>(modes[i]->h));
+ toString(static_cast<int>(modes[i]->w)).append("x")
+ .append(toString(static_cast<int>(modes[i]->h)));
logger->log("support mode: " + modeString);
modeList.push_back(modeString);
}
@@ -395,7 +395,7 @@ void GraphicsManager::updateExtensions()
std::string str = reinterpret_cast<const char*>(
mglGetStringi(GL_EXTENSIONS, f));
mExtensions.insert(str);
- extList += str + " ";
+ extList.append(str).append(" ");
}
logger->log1(extList.c_str());
}
@@ -898,78 +898,77 @@ static CALLBACK void debugCallback(GLenum source, GLenum type, GLuint id,
switch (source)
{
case GL_DEBUG_SOURCE_API:
- message += " API";
+ message.append(" API");
break;
case GL_DEBUG_SOURCE_WINDOW_SYSTEM:
- message += " WM";
+ message.append(" WM");
break;
case GL_DEBUG_SOURCE_SHADER_COMPILER:
- message += " SHADERS";
+ message.append(" SHADERS");
break;
case GL_DEBUG_SOURCE_THIRD_PARTY:
- message += " THIRD_PARTY";
+ message.append(" THIRD_PARTY");
break;
case GL_DEBUG_SOURCE_APPLICATION:
- message += " APP";
+ message.append(" APP");
break;
case GL_DEBUG_SOURCE_OTHER:
- message += " OTHER";
+ message.append(" OTHER");
break;
default:
- message += " ?" + toString(source);
+ message.append(" ?").append(toString(source));
break;
}
switch (type)
{
case GL_DEBUG_TYPE_ERROR:
- message += " ERROR";
+ message.append(" ERROR");
break;
case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR:
- message += " DEPRECATED";
+ message.append(" DEPRECATED");
break;
case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR:
- message += " UNDEFINED";
+ message.append(" UNDEFINED");
break;
case GL_DEBUG_TYPE_PORTABILITY:
- message += " PORTABILITY";
+ message.append(" PORTABILITY");
break;
case GL_DEBUG_TYPE_PERFORMANCE:
- message += " PERFOMANCE";
+ message.append(" PERFOMANCE");
break;
case GL_DEBUG_TYPE_OTHER:
- message += " OTHER";
+ message.append(" OTHER");
break;
case GL_DEBUG_TYPE_MARKER:
- message += " MARKER";
+ message.append(" MARKER");
break;
default:
- message += " ?" + toString(type);
+ message.append(" ?").append(toString(type));
break;
}
- message += " " + toString(id);
+ message.append(" ").append(toString(id));
switch (severity)
{
case GL_DEBUG_SEVERITY_NOTIFICATION:
- message += " N";
+ message.append(" N");
break;
case GL_DEBUG_SEVERITY_HIGH:
- message += " H";
+ message.append(" H");
break;
case GL_DEBUG_SEVERITY_MEDIUM:
- message += " M";
+ message.append(" M");
break;
case GL_DEBUG_SEVERITY_LOW:
- message += " L";
+ message.append(" L");
break;
default:
- message += " ?" + toString(type);
+ message.append(" ?").append(toString(type));
break;
}
char *buf = new char[length + 1];
memcpy (buf, text, length);
buf[length] = 0;
- message += " ";
- message += buf;
+ message.append(" ").append(buf);
delete [] buf;
logger->log(message);
}
diff --git a/src/item.cpp b/src/item.cpp
index 37d353fb4..261279002 100644
--- a/src/item.cpp
+++ b/src/item.cpp
@@ -82,7 +82,8 @@ void Item::setId(const int id, const unsigned char color)
mTags = info.getTags();
SpriteDisplay display = info.getDisplay();
- std::string imagePath = paths.getStringValue("itemIcons") + display.image;
+ std::string imagePath = paths.getStringValue(
+ "itemIcons").append(display.image);
std::string dye = combineDye2(imagePath, info.getDyeColorsString(color));
mImage = resman->getImage(dye);
mDrawImage = resman->getImage(dye);
@@ -112,9 +113,9 @@ Image *Item::getImage(const int id, const unsigned char color)
ResourceManager *const resman = ResourceManager::getInstance();
const ItemInfo &info = ItemDB::get(id);
SpriteDisplay display = info.getDisplay();
- std::string imagePath = paths.getStringValue("itemIcons") + display.image;
- Image *image;
- image = resman->getImage(combineDye2(imagePath,
+ std::string imagePath = paths.getStringValue(
+ "itemIcons").append(display.image);
+ Image *image = resman->getImage(combineDye2(imagePath,
info.getDyeColorsString(color)));
if (!image)
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index a9213f75e..fd7f863c8 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -1718,8 +1718,8 @@ void LocalPlayer::processEvent(Channels channel,
{
mMessages.pop_back();
// TRANSLATORS: this is job experience
- pair.first += strprintf (", %d %s",
- change, _("job"));
+ pair.first.append(strprintf (", %d %s",
+ change, _("job")));
mMessages.push_back(pair);
}
else
diff --git a/src/logger.cpp b/src/logger.cpp
index e9ef6173f..c6ccbdbe8 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -222,7 +222,8 @@ void Logger::safeError(const std::string &error_text)
// (ConstStr255Param) msg, nullptr, nullptr);
#elif defined(__linux__) || defined(__linux)
std::cerr << "Error: " << error_text << std::endl;
- const std::string msg = "xmessage \"" + error_text + "\"";
+ const std::string msg = std::string("xmessage \"").append(
+ error_text).append("\"");
if (system(msg.c_str()) == -1)
std::cerr << "Error: " << error_text << std::endl;
#else
diff --git a/src/spellmanager.cpp b/src/spellmanager.cpp
index 93480fb63..77248c68b 100644
--- a/src/spellmanager.cpp
+++ b/src/spellmanager.cpp
@@ -218,7 +218,7 @@ std::string SpellManager::parseCommand(std::string command,
}
if (!found && !name.empty())
- command += " " + name;
+ command.append(" ").append(name);
return command;
}
@@ -385,7 +385,7 @@ std::string SpellManager::autoComplete(std::string partName)
if (newName != "" && newCommand
&& newCommand->getTargetType() == NEEDTARGET)
{
- return newName + " ";
+ return newName.append(" ");
}
return newName;
}