summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/emotedb.cpp8
-rw-r--r--src/resources/emotedb.h2
-rw-r--r--src/resources/image.cpp18
-rw-r--r--src/resources/image.h11
-rw-r--r--src/resources/itemdb.h5
-rw-r--r--src/resources/iteminfo.h14
-rw-r--r--src/resources/monsterdb.cpp6
7 files changed, 24 insertions, 40 deletions
diff --git a/src/resources/emotedb.cpp b/src/resources/emotedb.cpp
index fde7030a..752f7b4f 100644
--- a/src/resources/emotedb.cpp
+++ b/src/resources/emotedb.cpp
@@ -21,12 +21,10 @@
#include "resources/emotedb.h"
-#include "configuration.h"
#include "log.h"
#include "imagesprite.h"
#include "resources/resourcemanager.h"
-#include "resources/image.h"
#include "resources/imageset.h"
namespace
@@ -134,10 +132,8 @@ const Emote *EmoteDB::get(int id)
logger->log("EmoteDB: Warning, unknown emote ID %d requested", id);
return &mUnknown;
}
- else
- {
- return i->second;
- }
+
+ return i->second;
}
int EmoteDB::getLast()
diff --git a/src/resources/emotedb.h b/src/resources/emotedb.h
index cdcb5cf6..cc3b30f7 100644
--- a/src/resources/emotedb.h
+++ b/src/resources/emotedb.h
@@ -22,9 +22,9 @@
#ifndef EMOTE_DB_H
#define EMOTE_DB_H
-#include <list>
#include <map>
#include <string>
+
#include "utils/xml.h"
class ImageSprite;
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index c05b03aa..e643143b 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -45,20 +45,14 @@ bool Image::mDisableTransparency = false;
SDL_Renderer *Image::mRenderer;
Image::Image(SDL_Texture *texture, int width, int height):
- mAlpha(1.0f),
+ mLoaded(texture != nullptr),
mTexture(texture)
{
-#ifdef USE_OPENGL
- mGLImage = 0;
-#endif
-
mBounds.x = 0;
mBounds.y = 0;
mBounds.w = width;
mBounds.h = height;
- mLoaded = mTexture != nullptr;
-
if (!mLoaded)
{
logger->log(
@@ -68,8 +62,7 @@ Image::Image(SDL_Texture *texture, int width, int height):
#ifdef USE_OPENGL
Image::Image(GLuint glimage, int width, int height, int texWidth, int texHeight):
- mAlpha(1.0f),
- mTexture(nullptr),
+ mLoaded(glimage != 0),
mGLImage(glimage),
mTexWidth(texWidth),
mTexHeight(texHeight)
@@ -79,13 +72,10 @@ Image::Image(GLuint glimage, int width, int height, int texWidth, int texHeight)
mBounds.w = width;
mBounds.h = height;
- if (mGLImage)
- mLoaded = true;
- else
+ if (!mLoaded)
{
logger->log(
- "Image::Image(GLuint*, ...): Couldn't load invalid Surface!");
- mLoaded = false;
+ "Image::Image(GLuint, ...): Couldn't load invalid Surface!");
}
}
#endif
diff --git a/src/resources/image.h b/src/resources/image.h
index 66c3ff78..662c0393 100644
--- a/src/resources/image.h
+++ b/src/resources/image.h
@@ -38,7 +38,6 @@
#endif
class Dye;
-class Position;
/**
* Defines a class for loading and storing images.
@@ -87,7 +86,7 @@ class Image : public Resource
/**
* Tells is the image is loaded
*/
- bool isLoaded()
+ bool isLoaded() const
{ return mLoaded; }
/**
@@ -164,8 +163,8 @@ class Image : public Resource
// -----------------------
SDL_Rect mBounds;
- bool mLoaded;
- float mAlpha;
+ bool mLoaded = false;
+ float mAlpha = 1.0f;
// -----------------------
// SDL protected members
@@ -177,7 +176,7 @@ class Image : public Resource
/** SDL_Surface to SDL_Texture Image loader */
static Image *_SDLload(SDL_Surface *tmpImage);
- SDL_Texture *mTexture;
+ SDL_Texture *mTexture = nullptr;
/** Stores whether the transparency is disabled */
static bool mDisableTransparency;
@@ -201,7 +200,7 @@ class Image : public Resource
static Image *_GLload(SDL_Surface *image);
- GLuint mGLImage;
+ GLuint mGLImage = 0;
int mTexWidth, mTexHeight;
static bool mUseOpenGL;
diff --git a/src/resources/itemdb.h b/src/resources/itemdb.h
index d8d37bc4..412e64ce 100644
--- a/src/resources/itemdb.h
+++ b/src/resources/itemdb.h
@@ -161,7 +161,7 @@ class TaItemInfo;
class TaItemDB: public ItemDB
{
public:
- TaItemDB() : ItemDB()
+ TaItemDB()
{ }
~TaItemDB() override
@@ -172,6 +172,7 @@ class TaItemDB: public ItemDB
void readItemNode(xmlNodePtr node, const std::string &filename) override;
void checkStatus() override;
+
private:
/**
* Check items id specific hard limits and log errors found.
@@ -195,7 +196,7 @@ class ManaServItemInfo;
class ManaServItemDB: public ItemDB
{
public:
- ManaServItemDB() : ItemDB()
+ ManaServItemDB()
{ }
~ManaServItemDB() override
diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h
index df559d69..5763e423 100644
--- a/src/resources/iteminfo.h
+++ b/src/resources/iteminfo.h
@@ -161,8 +161,8 @@ class ItemInfo
int mView = 0; /**< Item ID of how this item looks. */
int mId = 0; /**< Item ID */
- bool mEquippable; /**< Whether this item can be equipped. */
- bool mActivatable; /**< Whether this item can be activated. */
+ bool mEquippable = false; /**< Whether this item can be equipped. */
+ bool mActivatable = false; /**< Whether this item can be activated. */
// Equipment related members.
/** Attack type, in case of weapon.
@@ -172,12 +172,12 @@ class ItemInfo
std::string mAttackAction;
/** Attack range, will be equal to ATTACK_RANGE_NOT_SET if no weapon. */
- int mAttackRange;
+ int mAttackRange = 0;
/** Effects to be shown when weapon attacks - see also effects.xml */
std::string mMissileParticleFile;
- int mHitEffectId;
- int mCriticalHitEffectId;
+ int mHitEffectId = 0;
+ int mCriticalHitEffectId = 0;
/** Maps gender to sprite filenames. */
std::map<int, std::string> mAnimationFiles;
@@ -230,7 +230,7 @@ class TaItemInfo: public ItemInfo
friend class TaItemDB;
public:
- TaItemInfo() : ItemInfo()
+ TaItemInfo()
{}
// Declare TmwAthena Specific item info here
@@ -247,7 +247,7 @@ namespace ManaServ {
class ManaServItemInfo: public ItemInfo
{
public:
- ManaServItemInfo() : ItemInfo()
+ ManaServItemInfo()
{}
// Declare Manaserv Specific item info here
diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp
index c4abeecf..5f62f418 100644
--- a/src/resources/monsterdb.cpp
+++ b/src/resources/monsterdb.cpp
@@ -182,8 +182,6 @@ BeingInfo *MonsterDB::get(int id)
logger->log("MonsterDB: Warning, unknown monster ID %d requested", id);
return BeingInfo::Unknown;
}
- else
- {
- return i->second;
- }
+
+ return i->second;
}