summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-03-24 19:17:41 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-04-02 20:57:16 +0200
commit59919635523d41f3a15120c83db4b7d080c155de (patch)
tree0da989bd2342b5a53d49c26893a3a544e7432fcc /src/resources
parent7ea1c4574d6e845f95f2c4c3a1dd4a5d730bc6ba (diff)
downloadmana-59919635523d41f3a15120c83db4b7d080c155de.tar.gz
mana-59919635523d41f3a15120c83db4b7d080c155de.tar.bz2
mana-59919635523d41f3a15120c83db4b7d080c155de.tar.xz
mana-59919635523d41f3a15120c83db4b7d080c155de.zip
General code cleanups
* Removed some unused includes * Removed unused ListBox::mFont * Removed wrong cast to SDL_Scancode * Removed superfluous .c_str() * Removed superfluous explicit std::string construction * Removed unused variable * Use more emplace_back * Turned FindBeingFunctor into a lambda * Avoid needless pointer references for ambient layers and use a vector
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/dye.cpp2
-rw-r--r--src/resources/image.cpp2
-rw-r--r--src/resources/image.h2
-rw-r--r--src/resources/itemdb.cpp6
-rw-r--r--src/resources/iteminfo.h2
5 files changed, 6 insertions, 8 deletions
diff --git a/src/resources/dye.cpp b/src/resources/dye.cpp
index 92c830dc..d594299c 100644
--- a/src/resources/dye.cpp
+++ b/src/resources/dye.cpp
@@ -134,7 +134,7 @@ void DyePalette::getColor(int intensity, int color[3]) const
void DyePalette::getColor(double intensity, int color[3]) const
{
// Nothing to do here
- if (mColors.size() == 0)
+ if (mColors.empty())
return;
// Force range
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index ecf6a6be..328ea9b8 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -111,7 +111,7 @@ Resource *Image::load(SDL_RWops *rw)
return image;
}
-Resource *Image::load(SDL_RWops *rw, Dye const &dye)
+Resource *Image::load(SDL_RWops *rw, const Dye &dye)
{
SDL_Surface *tmpImage = IMG_Load_RW(rw, 1);
diff --git a/src/resources/image.h b/src/resources/image.h
index f91d2275..e2e240c3 100644
--- a/src/resources/image.h
+++ b/src/resources/image.h
@@ -71,7 +71,7 @@ class Image : public Resource
* @return <code>NULL</code> if an error occurred, a valid pointer
* otherwise.
*/
- static Resource *load(SDL_RWops *rw, Dye const &dye);
+ static Resource *load(SDL_RWops *rw, const Dye &dye);
/**
* Loads an image from an SDL surface.
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index 6ff3f58c..8ba80a51 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -236,9 +236,8 @@ void ItemDB::loadCommonRef(ItemInfo *itemInfo, xmlNodePtr node, const std::strin
{
if (xmlStrEqual(itemChild->name, BAD_CAST "sprite"))
{
- std::string attackParticle = XML::getProperty(
- itemChild, "particle-effect", "");
- itemInfo->mParticle = attackParticle;
+ itemInfo->mParticle = XML::getProperty(
+ itemChild, "particle-effect", std::string());
loadSpriteRef(itemInfo, itemChild);
}
@@ -272,7 +271,6 @@ void ItemDB::addItem(ItemInfo *itemInfo)
else
logger->log("ItemDB: Duplicate name (%s) for item id %d found.",
temp.c_str(), itemInfo->mId);
-
}
}
diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h
index 5922b6c1..c3a15376 100644
--- a/src/resources/iteminfo.h
+++ b/src/resources/iteminfo.h
@@ -91,7 +91,7 @@ class ItemInfo
const std::string &getName() const
{ return mName; }
- std::string getParticleEffect() const
+ const std::string &getParticleEffect() const
{ return mParticle; }
const SpriteDisplay &getDisplay() const