summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2011-06-02 00:32:53 +0200
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2011-06-02 16:41:47 +0200
commit4e27937924766948d7ff9200f04a37fe4d59018c (patch)
treec1f5c255192c85a82c77c2f8f916984e2b863c44 /src/resources
parentc2eab288ecc7d7c5e26d02ccecf285cbc0c218ed (diff)
downloadmana-client-4e27937924766948d7ff9200f04a37fe4d59018c.tar.gz
mana-client-4e27937924766948d7ff9200f04a37fe4d59018c.tar.bz2
mana-client-4e27937924766948d7ff9200f04a37fe4d59018c.tar.xz
mana-client-4e27937924766948d7ff9200f04a37fe4d59018c.zip
Arbitrary code cleanups
Just some stuff that piles up while "looking" at the code, which eventually gets annoying to ignore while staging real changes. * Replaced a few NULL occurrences with 0 * Rely on default parameter for std::vector::resize. * Replaced a few "" with std::string() * Prefer .empty() to == "" * Removed a few comparisons with NULL * Don't check pointers before deleting them * Removed a bunch of redundant semicolons * Made some global variables static (local to their compilation unit) * Prefer prefix ++/-- operators to postfix versions when possible * Corrected location of a comment
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/itemdb.cpp2
-rw-r--r--src/resources/itemdb.h18
-rw-r--r--src/resources/iteminfo.h12
-rw-r--r--src/resources/resource.cpp4
4 files changed, 22 insertions, 14 deletions
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index 1457b6dd..e913bb0a 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -551,4 +551,4 @@ void ManaServItemDB::checkItemInfo(ItemInfo* itemInfo)
// Add specific Manaserv checks here
}
-}; // namespace ManaServ
+} // namespace ManaServ
diff --git a/src/resources/itemdb.h b/src/resources/itemdb.h
index e80f2cd0..aa6e62c0 100644
--- a/src/resources/itemdb.h
+++ b/src/resources/itemdb.h
@@ -33,9 +33,13 @@
class ItemInfo;
class SpriteDisplay;
-// Used to make the compiler uderstand the iteminfo friendship.
-namespace TmwAthena { class TaItemDB; };
-namespace ManaServ { class ManaServItemDB; };
+namespace TmwAthena {
+class TaItemDB;
+}
+
+namespace ManaServ {
+class ManaServItemDB;
+}
/**
* Nano-description functions
@@ -48,10 +52,10 @@ class ItemStat
public:
ItemStat(const std::string &tag,
- const std::string &format):
+ const std::string &format):
mTag(tag), mFormat(format) {}
- bool operator ==(std::string &name) const
+ bool operator ==(const std::string &name) const
{ return mTag == name; }
private:
@@ -176,7 +180,7 @@ class TaItemDB: public ItemDB
void checkItemInfo(ItemInfo* itemInfo);
};
-}; // namespace TmwAthena
+} // namespace TmwAthena
namespace ManaServ {
@@ -203,7 +207,7 @@ class ManaServItemDB: public ItemDB
void checkItemInfo(ItemInfo* itemInfo);
};
-}; // namespace ManaServ
+} // namespace ManaServ
extern ItemDB *itemDb;
diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h
index 4ab66597..24872060 100644
--- a/src/resources/iteminfo.h
+++ b/src/resources/iteminfo.h
@@ -60,9 +60,13 @@ enum ItemType
ITEM_SPRITE_HAIR // 15
};
-// Used to make the compiler uderstand the iteminfo friendship.
-namespace TmwAthena { class TaItemDB; };
-namespace ManaServ { class ManaServItemDB; };
+namespace TmwAthena {
+class TaItemDB;
+}
+
+namespace ManaServ {
+class ManaServItemDB;
+}
/**
* Defines a class for storing generic item infos.
@@ -256,4 +260,4 @@ class ManaServItemInfo: public ItemInfo
} // namespace ManaServ
-#endif
+#endif // ITEMINFO_H
diff --git a/src/resources/resource.cpp b/src/resources/resource.cpp
index 349e2948..f60009ab 100644
--- a/src/resources/resource.cpp
+++ b/src/resources/resource.cpp
@@ -33,7 +33,7 @@ Resource::~Resource()
void Resource::incRef()
{
- mRefCount++;
+ ++mRefCount;
}
void Resource::decRef()
@@ -44,7 +44,7 @@ void Resource::decRef()
assert(false);
}
- mRefCount--;
+ --mRefCount;
if (mRefCount == 0)
{