summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-03-25 23:42:57 +0100
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-03-25 23:42:57 +0100
commitcd20fb3432498b8871401bdd65a143197e2a6538 (patch)
tree1edd3e20e3501de5315fa5bfc46b8673ad40d5dd /src/resources
parent4ba8c80791c15c144d66e6a9b23e878d3313fa26 (diff)
downloadmana-cd20fb3432498b8871401bdd65a143197e2a6538.tar.gz
mana-cd20fb3432498b8871401bdd65a143197e2a6538.tar.bz2
mana-cd20fb3432498b8871401bdd65a143197e2a6538.tar.xz
mana-cd20fb3432498b8871401bdd65a143197e2a6538.zip
A host of code style fixes
Mostly putting & and * in the right place and making some getters const.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/colordb.cpp2
-rw-r--r--src/resources/colordb.h2
-rw-r--r--src/resources/iteminfo.cpp4
-rw-r--r--src/resources/iteminfo.h16
-rw-r--r--src/resources/monsterinfo.h2
-rw-r--r--src/resources/resource.h4
-rw-r--r--src/resources/resourcemanager.cpp2
-rw-r--r--src/resources/resourcemanager.h2
-rw-r--r--src/resources/spritedef.cpp2
9 files changed, 18 insertions, 18 deletions
diff --git a/src/resources/colordb.cpp b/src/resources/colordb.cpp
index 3a8754ea..07496ff6 100644
--- a/src/resources/colordb.cpp
+++ b/src/resources/colordb.cpp
@@ -98,7 +98,7 @@ void ColorDB::unload()
mLoaded = false;
}
-std::string& ColorDB::get(int id)
+std::string &ColorDB::get(int id)
{
if (!mLoaded)
load();
diff --git a/src/resources/colordb.h b/src/resources/colordb.h
index c581f653..4a8a0cab 100644
--- a/src/resources/colordb.h
+++ b/src/resources/colordb.h
@@ -40,7 +40,7 @@ namespace ColorDB
*/
void unload();
- std::string& get(int id);
+ std::string &get(int id);
int size();
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index f7118755..3506de16 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -22,7 +22,7 @@
#include "itemdb.h"
#include "iteminfo.h"
-const std::string& ItemInfo::getSprite(Gender gender) const
+const std::string &ItemInfo::getSprite(Gender gender) const
{
if (mView)
{
@@ -91,7 +91,7 @@ void ItemInfo::addSound(EquipmentSoundEvent event, const std::string &filename)
mSounds[event].push_back("sfx/" + filename);
}
-const std::string& ItemInfo::getSound(EquipmentSoundEvent event) const
+const std::string &ItemInfo::getSound(EquipmentSoundEvent event) const
{
static const std::string empty;
std::map< EquipmentSoundEvent, std::vector<std::string> >::const_iterator i;
diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h
index 51b39876..d84ee603 100644
--- a/src/resources/iteminfo.h
+++ b/src/resources/iteminfo.h
@@ -135,7 +135,7 @@ class ItemInfo
void setName(const std::string &name)
{ mName = name; }
- const std::string& getName() const
+ const std::string &getName() const
{ return mName; }
void setParticleEffect(const std::string &particleEffect)
@@ -146,19 +146,19 @@ class ItemInfo
void setImageName(const std::string &imageName)
{ mImageName = imageName; }
- const std::string& getImageName() const
+ const std::string &getImageName() const
{ return mImageName; }
void setDescription(const std::string &description)
{ mDescription = description; }
- const std::string& getDescription() const
+ const std::string &getDescription() const
{ return mDescription; }
void setEffect(const std::string &effect)
{ mEffect = effect; }
- const std::string& getEffect() const { return mEffect; }
+ const std::string &getEffect() const { return mEffect; }
#ifdef TMWSERV_SUPPORT
void setType(short type)
@@ -167,10 +167,10 @@ class ItemInfo
short getType() const
{ return mType; }
#else
- void setType(const std::string& type)
+ void setType(const std::string &type)
{ mType = type; }
- const std::string& getType() const { return mType; }
+ const std::string &getType() const { return mType; }
#endif
void setWeight(short weight)
@@ -185,7 +185,7 @@ class ItemInfo
void setSprite(const std::string &animationFile, Gender gender)
{ mAnimationFiles[gender] = animationFile; }
- const std::string& getSprite(Gender gender) const;
+ const std::string &getSprite(Gender gender) const;
void setWeaponType(int);
@@ -200,7 +200,7 @@ class ItemInfo
void addSound(EquipmentSoundEvent event, const std::string &filename);
- const std::string& getSound(EquipmentSoundEvent event) const;
+ const std::string &getSound(EquipmentSoundEvent event) const;
protected:
std::string mImageName; /**< The filename of the icon image. */
diff --git a/src/resources/monsterinfo.h b/src/resources/monsterinfo.h
index 02574147..d8a5bfd0 100644
--- a/src/resources/monsterinfo.h
+++ b/src/resources/monsterinfo.h
@@ -74,7 +74,7 @@ class MonsterInfo
void addParticleEffect(const std::string &filename);
- const std::string& getName() const
+ const std::string &getName() const
{ return mName; }
const std::list<std::string>& getSprites() const
diff --git a/src/resources/resource.h b/src/resources/resource.h
index 7c5f989e..5b70c720 100644
--- a/src/resources/resource.h
+++ b/src/resources/resource.h
@@ -55,8 +55,8 @@ class Resource
/**
* Return the path identifying this resource.
*/
- const std::string&
- getIdPath() { return mIdPath; }
+ const std::string &getIdPath() const
+ { return mIdPath; }
protected:
/**
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 50eda0ce..ddd9ec93 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -440,7 +440,7 @@ std::vector<std::string> ResourceManager::loadTextFile(const std::string &fileNa
return lines;
}
-SDL_Surface *ResourceManager::loadSDLSurface(const std::string& filename)
+SDL_Surface *ResourceManager::loadSDLSurface(const std::string &filename)
{
int fileSize;
void *buffer = loadFile(filename, fileSize);
diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h
index c3c68d88..828c5b0a 100644
--- a/src/resources/resourcemanager.h
+++ b/src/resources/resourcemanager.h
@@ -183,7 +183,7 @@ class ResourceManager
* Loads the given filename as an SDL surface. The returned surface is
* expected to be freed by the caller using SDL_FreeSurface.
*/
- SDL_Surface *loadSDLSurface(const std::string& filename);
+ SDL_Surface *loadSDLSurface(const std::string &filename);
/**
* Returns an instance of the class, creating one if it does not
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index 125edbea..1362c81c 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -401,7 +401,7 @@ SpriteAction SpriteDef::makeSpriteAction(const std::string &action)
}
}
-SpriteDirection SpriteDef::makeSpriteDirection(const std::string& direction)
+SpriteDirection SpriteDef::makeSpriteDirection(const std::string &direction)
{
if (direction.empty() || direction == "default") {
return DIRECTION_DEFAULT;