diff options
author | Andrei Karas <akaras@inbox.ru> | 2010-03-08 17:45:40 +0200 |
---|---|---|
committer | Bertram <yohanndotferreiraatorange.fr> | 2010-03-08 17:12:38 +0100 |
commit | 9951bf6c1c2e3966f92f1545b60a9e23a1f32565 (patch) | |
tree | e3f9fbcb3ff252390a1af4137ddfd8694b8c77e4 | |
parent | 71cefdb345652342a3eaf84f197586809128e6ab (diff) | |
download | mana-9951bf6c1c2e3966f92f1545b60a9e23a1f32565.tar.gz mana-9951bf6c1c2e3966f92f1545b60a9e23a1f32565.tar.bz2 mana-9951bf6c1c2e3966f92f1545b60a9e23a1f32565.tar.xz mana-9951bf6c1c2e3966f92f1545b60a9e23a1f32565.zip |
Fix properties bug.
Fix Random crushes and valgrind memory errors.
Reviewed-by: thorbjorn
-rw-r--r-- | src/map.cpp | 4 | ||||
-rw-r--r-- | src/map.h | 4 | ||||
-rw-r--r-- | src/properties.h | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/map.cpp b/src/map.cpp index b1bd634b..9f0a901b 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -564,12 +564,12 @@ void Map::removeSprite(MapSprite iterator) mSprites.erase(iterator); } -const std::string &Map::getMusicFile() const +const std::string Map::getMusicFile() const { return getProperty("music"); } -const std::string &Map::getName() const +const std::string Map::getName() const { if (hasProperty("name")) return getProperty("name"); @@ -263,8 +263,8 @@ class Map : public Properties int getTileHeight() const { return mTileHeight; } - const std::string &getMusicFile() const; - const std::string &getName() const; + const std::string getMusicFile() const; + const std::string getName() const; /** * Gives the map id based on filepath (ex: 009-1) diff --git a/src/properties.h b/src/properties.h index 18eafc6b..1320b0c9 100644 --- a/src/properties.h +++ b/src/properties.h @@ -45,7 +45,7 @@ class Properties * @return the value of the given property or the given default when it * doesn't exist. */ - const std::string &getProperty(const std::string &name, + const std::string getProperty(const std::string &name, const std::string &def = "") const { PropertyMap::const_iterator i = mProperties.find(name); |