summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/being.cpp1
-rw-r--r--src/being.h38
-rw-r--r--src/imageparticle.h3
-rw-r--r--src/particle.cpp75
-rw-r--r--src/particle.h84
-rw-r--r--src/resources/action.cpp11
-rw-r--r--src/resources/mapreader.cpp29
-rw-r--r--src/resources/mapreader.h19
-rw-r--r--src/resources/monsterdb.cpp11
-rw-r--r--src/resources/resourcemanager.cpp53
-rw-r--r--src/resources/resourcemanager.h54
-rw-r--r--src/textparticle.h4
12 files changed, 144 insertions, 238 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 3a84ccd0..7c37d8e3 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -18,6 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#include "being.h"
#include <cassert>
diff --git a/src/being.h b/src/being.h
index 9bf88d82..f9e6c58f 100644
--- a/src/being.h
+++ b/src/being.h
@@ -153,28 +153,25 @@ class Being : public Sprite
*
* @param amount The amount of damage.
*/
- virtual void
- takeDamage(int amount);
+ virtual void takeDamage(int amount);
/**
* Handles an attack of another being by this being.
*/
- virtual void
- handleAttack();
+ virtual void handleAttack();
/**
* Returns the name of the being.
*/
- const std::string&
- getName() const { return mName; }
+ const std::string &getName() const
+ { return mName; }
/**
* Sets the name for the being.
*
* @param name The name that should appear.
*/
- void
- setName(const std::string &name) { mName = name; }
+ void setName(const std::string &name) { mName = name; }
/**
* Sets the gender for this being.
@@ -206,32 +203,28 @@ class Being : public Sprite
/**
* Sets visible equipments for this being.
*/
- virtual void
- setSprite(int slot, int id, const std::string &color = "");
+ virtual void setSprite(int slot, int id,
+ const std::string &color = "");
/**
* Performs being logic.
*/
- virtual void
- logic();
+ virtual void logic();
/**
* Draws the speech text above the being.
*/
- void
- drawSpeech(Graphics* graphics, int offsetX, int offsetY);
+ void drawSpeech(Graphics* graphics, int offsetX, int offsetY);
/**
* Draws the emotion picture above the being.
*/
- void
- drawEmotion(Graphics *graphics, int offsetX, int offsetY);
+ void drawEmotion(Graphics *graphics, int offsetX, int offsetY);
/**
* Draws the name text below the being.
*/
- virtual void
- drawName(Graphics *, int, int) {};
+ virtual void drawName(Graphics *, int, int) {};
/**
* Returns the type of the being.
@@ -252,14 +245,12 @@ class Being : public Sprite
/**
* Gets the being id.
*/
- Uint16
- getId() const { return mId; }
+ Uint16 getId() const { return mId; }
/**
* Sets the sprite id.
*/
- void
- setId(Uint16 id) { mId = id; }
+ void setId(Uint16 id) { mId = id; }
/**
* Sets the map the being is on
@@ -269,8 +260,7 @@ class Being : public Sprite
/**
* Sets the current action.
*/
- virtual void
- setAction(Action action, int attackType = 0);
+ virtual void setAction(Action action, int attackType = 0);
/**
* Gets the current action.
diff --git a/src/imageparticle.h b/src/imageparticle.h
index 91c5426c..c18b30b8 100644
--- a/src/imageparticle.h
+++ b/src/imageparticle.h
@@ -49,8 +49,7 @@ class ImageParticle : public Particle
/**
* Draws the particle image
*/
- virtual void
- draw(Graphics *graphics, int offsetX, int offsetY) const;
+ virtual void draw(Graphics *graphics, int offsetX, int offsetY) const;
protected:
Image *mImage; /**< The image used for this particle. */
diff --git a/src/particle.cpp b/src/particle.cpp
index 8a15a132..c6e242bd 100644
--- a/src/particle.cpp
+++ b/src/particle.cpp
@@ -68,12 +68,21 @@ Particle::Particle(Map *map):
mMomentum(1.0f)
{
Particle::particleCount++;
- if (mMap) setSpriteIterator(mMap->addSprite(this));
+ if (mMap)
+ setSpriteIterator(mMap->addSprite(this));
}
+Particle::~Particle()
+{
+ // Remove from map sprite list
+ if (mMap)
+ mMap->removeSprite(mSpriteIterator);
+ // Delete child emitters and child particles
+ clear();
+ Particle::particleCount--;
+}
-void
-Particle::setupEngine()
+void Particle::setupEngine()
{
Particle::maxCount = (int)config.getValue("particleMaxCount", 3000);
Particle::fastPhysics = (int)config.getValue("particleFastPhysics", 0);
@@ -82,17 +91,17 @@ Particle::setupEngine()
logger->log("Particle engine set up");
}
-void Particle::draw(Graphics *, int, int) const {}
+void Particle::draw(Graphics *, int, int) const
+{
+}
-bool
-Particle::update()
+bool Particle::update()
{
- if (!mMap) return false;
+ if (!mMap)
+ return false;
if (mLifetimeLeft == 0)
- {
mAlive = false;
- }
Vector oldPos = mPos;
@@ -222,9 +231,8 @@ Particle::update()
return true;
}
-Particle*
-Particle::addEffect(const std::string &particleEffectFile,
- int pixelX, int pixelY, int rotation)
+Particle *Particle::addEffect(const std::string &particleEffectFile,
+ int pixelX, int pixelY, int rotation)
{
Particle *newParticle = NULL;
@@ -298,11 +306,9 @@ Particle::addEffect(const std::string &particleEffectFile,
return newParticle;
}
-
-Particle*
-Particle::addTextSplashEffect(const std::string &text,
- int colorR, int colorG, int colorB,
- gcn::Font *font, int x, int y)
+Particle *Particle::addTextSplashEffect(const std::string &text,
+ int colorR, int colorG, int colorB,
+ gcn::Font *font, int x, int y)
{
Particle *newParticle = new TextParticle(mMap, text, colorR, colorG, colorB,
font);
@@ -320,11 +326,10 @@ Particle::addTextSplashEffect(const std::string &text,
return newParticle;
}
-Particle*
-Particle::addTextRiseFadeOutEffect(const std::string &text,
- int colorR, int colorG, int colorB,
- gcn::Font *font,
- int x, int y)
+Particle *Particle::addTextRiseFadeOutEffect(const std::string &text,
+ int colorR, int colorG, int colorB,
+ gcn::Font *font,
+ int x, int y)
{
Particle *newParticle = new TextParticle(mMap, text, colorR, colorG, colorB, font);
newParticle->setPosition(x, y, 0);
@@ -339,32 +344,18 @@ Particle::addTextRiseFadeOutEffect(const std::string &text,
return newParticle;
}
-void
-Particle::setMap(Map *map)
+void Particle::setMap(Map *map)
{
mMap = map;
- if (mMap) setSpriteIterator(mMap->addSprite(this));
+ if (mMap)
+ setSpriteIterator(mMap->addSprite(this));
}
-
-Particle::~Particle()
-{
- // Remove from map sprite list
- if (mMap) mMap->removeSprite(mSpriteIterator);
- // Delete child emitters and child particles
- clear();
- Particle::particleCount--;
-}
-
-
-void
-Particle::clear()
+void Particle::clear()
{
- std::for_each(mChildEmitters.begin(), mChildEmitters.end(),
- make_dtor(mChildEmitters));
+ delete_all(mChildEmitters);
mChildEmitters.clear();
- std::for_each(mChildParticles.begin(), mChildParticles.end(),
- make_dtor(mChildParticles));
+ delete_all(mChildParticles);
mChildParticles.clear();
}
diff --git a/src/particle.h b/src/particle.h
index d98f2c39..af0caf21 100644
--- a/src/particle.h
+++ b/src/particle.h
@@ -67,22 +67,19 @@ class Particle : public Sprite
/**
* Deletes all child particles and emitters.
*/
- void
- clear();
+ void clear();
/**
* Gives a particle the properties of an engine root particle and loads
* the particle-related config settings.
*/
- void
- setupEngine();
+ void setupEngine();
/**
* Updates particle position, returns false when the particle should
* be deleted.
*/
- virtual bool
- update();
+ virtual bool update();
/**
* Draws the particle image.
@@ -92,8 +89,7 @@ class Particle : public Sprite
/**
* Necessary for sorting with the other sprites.
*/
- virtual int
- getPixelY() const
+ virtual int getPixelY() const
{ return (int) (mPos.y + mPos.z) - 64; }
/**
@@ -105,46 +101,40 @@ class Particle : public Sprite
* Creates a child particle that hosts some emitters described in the
* particleEffectFile.
*/
- Particle*
- addEffect(const std::string &particleEffectFile,
- int pixelX, int pixelY, int rotation = 0);
+ Particle *addEffect(const std::string &particleEffectFile,
+ int pixelX, int pixelY, int rotation = 0);
/**
* Creates a standalone text particle.
*/
- Particle*
- addTextSplashEffect(const std::string &text,
- int colorR, int colorG, int colorB,
- gcn::Font *font, int x, int y);
+ Particle *addTextSplashEffect(const std::string &text,
+ int colorR, int colorG, int colorB,
+ gcn::Font *font, int x, int y);
/**
* Creates a standalone text particle.
*/
- Particle*
- addTextRiseFadeOutEffect(const std::string &text,
- int colorR, int colorG, int colorB,
- gcn::Font *font,
- int x, int y);
+ Particle *addTextRiseFadeOutEffect(const std::string &text,
+ int colorR, int colorG, int colorB,
+ gcn::Font *font,
+ int x, int y);
/**
* Adds an emitter to the particle.
*/
- void
- addEmitter (ParticleEmitter* emitter)
+ void addEmitter (ParticleEmitter* emitter)
{ mChildEmitters.push_back(emitter); }
/**
* Sets the position in 3 dimensional space in pixels relative to map.
*/
- void
- setPosition(float x, float y, float z)
+ void setPosition(float x, float y, float z)
{ mPos.x = x; mPos.y = y; mPos.z = z; }
/**
* Sets the position in 2 dimensional space in pixels relative to map.
*/
- void
- setPosition(float x, float y)
+ void setPosition(float x, float y)
{ mPos.x = x; mPos.y = y; }
/**
@@ -156,53 +146,45 @@ class Particle : public Sprite
/**
* Changes the particle position relative
*/
- void
- moveBy(float x, float y, float z)
+ void moveBy(float x, float y, float z)
{ mPos.x += x; mPos.y += y; mPos.z += z; }
- void
- moveChildren(Vector change);
+ void moveChildren(Vector change);
- void
- moveBy (Vector change)
+ void moveBy (Vector change)
{ mPos += change; }
/**
* Sets the time in game ticks until the particle is destroyed.
*/
- void
- setLifetime(int lifetime)
+ void setLifetime(int lifetime)
{ mLifetimeLeft = lifetime; mLifetimePast = 0; }
/**
* Sets the age of the pixel in game ticks where the particle has
* faded in completely.
*/
- void
- setFadeOut(int fadeOut)
+ void setFadeOut(int fadeOut)
{ mFadeOut = fadeOut; }
/**
* Sets the remaining particle lifetime where the particle starts to
* fade out.
*/
- void
- setFadeIn(int fadeIn)
+ void setFadeIn(int fadeIn)
{ mFadeIn = fadeIn; }
/**
* Sets the alpha value of the particle
*/
- void
- setAlpha(float alpha)
+ void setAlpha(float alpha)
{ mAlpha = alpha; }
/**
* Sets the sprite iterator of the particle on the current map to make
* it easier to remove the particle from the map when it is destroyed.
*/
- void
- setSpriteIterator(std::list<Sprite*>::iterator spriteIterator)
+ void setSpriteIterator(std::list<Sprite*>::iterator spriteIterator)
{ mSpriteIterator = spriteIterator; }
/**
@@ -215,44 +197,38 @@ class Particle : public Sprite
/**
* Sets the current velocity in 3 dimensional space.
*/
- void
- setVelocity(float x, float y, float z)
+ void setVelocity(float x, float y, float z)
{ mVelocity.x = x; mVelocity.y = y; mVelocity.z = z; }
/**
* Sets the downward acceleration.
*/
- void
- setGravity(float gravity)
+ void setGravity(float gravity)
{ mGravity = gravity; }
/**
* Sets the ammount of random vector changes
*/
- void
- setRandomness(int r)
+ void setRandomness(int r)
{ mRandomness = r; }
/**
* Sets the ammount of velocity particles retain after
* hitting the ground.
*/
- void
- setBounce(float bouncieness)
+ void setBounce(float bouncieness)
{ mBounce = bouncieness; }
/**
* Sets the flag if the particle is supposed to be moved by its parent
*/
- void
- setFollow(bool follow)
+ void setFollow(bool follow)
{ mFollow = follow; }
/**
* Gets the flag if the particle is supposed to be moved by its parent
*/
- bool
- doesFollow()
+ bool doesFollow()
{ return mFollow; }
/**
diff --git a/src/resources/action.cpp b/src/resources/action.cpp
index ffbbffb2..bbea45c9 100644
--- a/src/resources/action.cpp
+++ b/src/resources/action.cpp
@@ -21,8 +21,6 @@
#include "action.h"
-#include <algorithm>
-
#include "animation.h"
#include "../utils/dtor.h"
@@ -34,12 +32,10 @@ Action::Action()
Action::~Action()
{
- std::for_each(mAnimations.begin(), mAnimations.end(),
- make_dtor(mAnimations));
+ delete_all(mAnimations);
}
-Animation*
-Action::getAnimation(int direction) const
+Animation *Action::getAnimation(int direction) const
{
Animations::const_iterator i = mAnimations.find(direction);
@@ -53,8 +49,7 @@ Action::getAnimation(int direction) const
return (i == mAnimations.end()) ? NULL : i->second;
}
-void
-Action::setAnimation(int direction, Animation *animation)
+void Action::setAnimation(int direction, Animation *animation)
{
mAnimations[direction] = animation;
}
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 34018022..949d7913 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -43,9 +43,8 @@ const unsigned int DEFAULT_TILE_HEIGHT = 32;
* Inflates either zlib or gzip deflated memory. The inflated memory is
* expected to be freed by the caller.
*/
-int
-inflateMemory(unsigned char *in, unsigned int inLength,
- unsigned char *&out, unsigned int &outLength)
+int inflateMemory(unsigned char *in, unsigned int inLength,
+ unsigned char *&out, unsigned int &outLength)
{
int bufferSize = 256 * 1024;
int ret;
@@ -109,9 +108,8 @@ inflateMemory(unsigned char *in, unsigned int inLength,
return ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR;
}
-int
-inflateMemory(unsigned char *in, unsigned int inLength,
- unsigned char *&out)
+int inflateMemory(unsigned char *in, unsigned int inLength,
+ unsigned char *&out)
{
unsigned int outLength = 0;
int ret = inflateMemory(in, inLength, out, outLength);
@@ -143,8 +141,7 @@ inflateMemory(unsigned char *in, unsigned int inLength,
return outLength;
}
-Map*
-MapReader::readMap(const std::string &filename)
+Map *MapReader::readMap(const std::string &filename)
{
// Load the file through resource manager
ResourceManager *resman = ResourceManager::getInstance();
@@ -201,8 +198,7 @@ MapReader::readMap(const std::string &filename)
return map;
}
-Map*
-MapReader::readMap(xmlNodePtr node, const std::string &path)
+Map *MapReader::readMap(xmlNodePtr node, const std::string &path)
{
// Take the filename off the path
const std::string pathDir = path.substr(0, path.rfind("/") + 1);
@@ -280,8 +276,7 @@ MapReader::readMap(xmlNodePtr node, const std::string &path)
return map;
}
-void
-MapReader::readProperties(xmlNodePtr node, Properties* props)
+void MapReader::readProperties(xmlNodePtr node, Properties *props)
{
for_each_xml_child_node(childNode, node)
{
@@ -311,8 +306,7 @@ static void setTile(Map *map, MapLayer *layer, int x, int y, int gid)
}
}
-void
-MapReader::readLayer(xmlNodePtr node, Map *map)
+void MapReader::readLayer(xmlNodePtr node, Map *map)
{
// Layers are not necessarily the same size as the map
const int w = XML::getProperty(node, "width", map->getWidth());
@@ -446,10 +440,9 @@ MapReader::readLayer(xmlNodePtr node, Map *map)
}
}
-Tileset*
-MapReader::readTileset(xmlNodePtr node,
- const std::string &path,
- Map *map)
+Tileset *MapReader::readTileset(xmlNodePtr node,
+ const std::string &path,
+ Map *map)
{
if (xmlHasProp(node, BAD_CAST "source"))
{
diff --git a/src/resources/mapreader.h b/src/resources/mapreader.h
index 0142eb45..04e83b99 100644
--- a/src/resources/mapreader.h
+++ b/src/resources/mapreader.h
@@ -39,15 +39,13 @@ class MapReader
/**
* Read an XML map from a file.
*/
- static Map*
- readMap(const std::string &filename);
+ static Map *readMap(const std::string &filename);
/**
* Read an XML map from a parsed XML tree. The path is used to find the
* location of referenced tileset images.
*/
- static Map*
- readMap(xmlNodePtr node, const std::string &path);
+ static Map *readMap(xmlNodePtr node, const std::string &path);
private:
/**
@@ -57,26 +55,23 @@ class MapReader
* @param props The Properties instance to which the properties will
* be assigned.
*/
- static void
- readProperties(xmlNodePtr node, Properties* props);
+ static void readProperties(xmlNodePtr node, Properties* props);
/**
* Reads a map layer and adds it to the given map.
*/
- static void
- readLayer(xmlNodePtr node, Map *map);
+ static void readLayer(xmlNodePtr node, Map *map);
/**
* Reads a tile set.
*/
- static Tileset*
- readTileset(xmlNodePtr node, const std::string &path, Map *map);
+ static Tileset *readTileset(xmlNodePtr node, const std::string &path,
+ Map *map);
/**
* Gets an integer property from an xmlNodePtr.
*/
- static int
- getProperty(xmlNodePtr node, const char* name, int def);
+ static int getProperty(xmlNodePtr node, const char* name, int def);
};
#endif
diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp
index e0c47db8..ed4acd38 100644
--- a/src/resources/monsterdb.cpp
+++ b/src/resources/monsterdb.cpp
@@ -19,8 +19,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <algorithm>
-
#include "monsterdb.h"
#include "resourcemanager.h"
@@ -147,19 +145,16 @@ MonsterDB::load()
mLoaded = true;
}
-void
-MonsterDB::unload()
+void MonsterDB::unload()
{
- for_each(mMonsterInfos.begin(), mMonsterInfos.end(),
- make_dtor(mMonsterInfos));
+ delete_all(mMonsterInfos);
mMonsterInfos.clear();
mLoaded = false;
}
-const MonsterInfo&
-MonsterDB::get(int id)
+const MonsterInfo &MonsterDB::get(int id)
{
MonsterInfoIterator i = mMonsterInfos.find(id);
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 08a4eec9..8c6d1376 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -93,8 +93,7 @@ ResourceManager::~ResourceManager()
}
}
-void
-ResourceManager::cleanUp(Resource *res)
+void ResourceManager::cleanUp(Resource *res)
{
logger->log("ResourceManager::~ResourceManager() cleaning up %d "
"reference%s to %s",
@@ -136,14 +135,12 @@ void ResourceManager::cleanOrphans()
mOldestOrphan = oldest;
}
-bool
-ResourceManager::setWriteDir(const std::string &path)
+bool ResourceManager::setWriteDir(const std::string &path)
{
return (bool) PHYSFS_setWriteDir(path.c_str());
}
-bool
-ResourceManager::addToSearchPath(const std::string &path, bool append)
+bool ResourceManager::addToSearchPath(const std::string &path, bool append)
{
logger->log("Adding to PhysicsFS: %s", path.c_str());
if (!PHYSFS_addToSearchPath(path.c_str(), append ? 1 : 0)) {
@@ -153,8 +150,7 @@ ResourceManager::addToSearchPath(const std::string &path, bool append)
return true;
}
-void
-ResourceManager::searchAndAddArchives(const std::string &path,
+void ResourceManager::searchAndAddArchives(const std::string &path,
const std::string &ext,
bool append)
{
@@ -180,31 +176,27 @@ ResourceManager::searchAndAddArchives(const std::string &path,
PHYSFS_freeList(list);
}
-bool
-ResourceManager::mkdir(const std::string &path)
+bool ResourceManager::mkdir(const std::string &path)
{
return (bool) PHYSFS_mkdir(path.c_str());
}
-bool
-ResourceManager::exists(const std::string &path)
+bool ResourceManager::exists(const std::string &path)
{
return PHYSFS_exists(path.c_str());
}
-bool
-ResourceManager::isDirectory(const std::string &path)
+bool ResourceManager::isDirectory(const std::string &path)
{
return PHYSFS_isDirectory(path.c_str());
}
-std::string
-ResourceManager::getPath(const std::string &file)
+std::string ResourceManager::getPath(const std::string &file)
{
// get the real path to the file
const char* tmp = PHYSFS_getRealDir(file.c_str());
std::string path;
-
+
// if the file is not in the search path, then its NULL
if (tmp)
{
@@ -215,11 +207,12 @@ ResourceManager::getPath(const std::string &file)
// if not found in search path return the default path
path = std::string(TMW_DATADIR) + std::string("data") + "/" + file;
}
-
+
return path;
}
-Resource *ResourceManager::get(std::string const &idPath, generator fun, void *data)
+Resource *ResourceManager::get(std::string const &idPath, generator fun,
+ void *data)
{
// Check if the id exists, and return the value if it does.
ResourceIterator resIter = mResources.find(idPath);
@@ -276,14 +269,12 @@ Resource *ResourceManager::load(std::string const &path, loader fun)
return get(path, ResourceLoader::load, &l);
}
-Music*
-ResourceManager::getMusic(const std::string &idPath)
+Music *ResourceManager::getMusic(const std::string &idPath)
{
return static_cast<Music*>(load(idPath, Music::load));
}
-SoundEffect*
-ResourceManager::getSoundEffect(const std::string &idPath)
+SoundEffect *ResourceManager::getSoundEffect(const std::string &idPath)
{
return static_cast<SoundEffect*>(load(idPath, SoundEffect::load));
}
@@ -336,8 +327,8 @@ struct ImageSetLoader
}
};
-ImageSet*
-ResourceManager::getImageSet(const std::string &imagePath, int w, int h)
+ImageSet *ResourceManager::getImageSet(const std::string &imagePath,
+ int w, int h)
{
ImageSetLoader l = { this, imagePath, w, h };
std::stringstream ss;
@@ -383,23 +374,20 @@ void ResourceManager::release(Resource *res)
mResources.erase(resIter);
}
-ResourceManager*
-ResourceManager::getInstance()
+ResourceManager *ResourceManager::getInstance()
{
// Create a new instance if necessary.
if (instance == NULL) instance = new ResourceManager();
return instance;
}
-void
-ResourceManager::deleteInstance()
+void ResourceManager::deleteInstance()
{
delete instance;
instance = NULL;
}
-void*
-ResourceManager::loadFile(const std::string &fileName, int &fileSize)
+void *ResourceManager::loadFile(const std::string &fileName, int &fileSize)
{
// Attempt to open the specified file using PhysicsFS
PHYSFS_file *file = PHYSFS_openRead(fileName.c_str());
@@ -451,8 +439,7 @@ ResourceManager::loadTextFile(const std::string &fileName)
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 66813a9c..c1007f4a 100644
--- a/src/resources/resourcemanager.h
+++ b/src/resources/resourcemanager.h
@@ -64,8 +64,7 @@ class ResourceManager
* @param path The path of the directory to be added.
* @return <code>true</code> on success, <code>false</code> otherwise.
*/
- bool
- setWriteDir(const std::string &path);
+ bool setWriteDir(const std::string &path);
/**
* Adds a directory or archive to the search path. If append is true
@@ -74,35 +73,30 @@ class ResourceManager
*
* @return <code>true</code> on success, <code>false</code> otherwise.
*/
- bool
- addToSearchPath(const std::string &path, bool append);
+ bool addToSearchPath(const std::string &path, bool append);
/**
* Searches for zip files and adds them to the search path.
*/
- void
- searchAndAddArchives(const std::string &path,
- const std::string &ext,
- bool append);
+ void searchAndAddArchives(const std::string &path,
+ const std::string &ext,
+ bool append);
/**
* Creates a directory in the write path
*/
- bool
- mkdir(const std::string &path);
+ bool mkdir(const std::string &path);
/**
* Checks whether the given file or directory exists in the search path
*/
- bool
- exists(const std::string &path);
+ bool exists(const std::string &path);
/**
* Checks whether the given path is a directory.
*/
- bool
- isDirectory(const std::string &path);
-
+ bool isDirectory(const std::string &path);
+
/**
* Returns the real path to a file
*
@@ -136,29 +130,25 @@ class ResourceManager
* Convenience wrapper around ResourceManager::get for loading
* images.
*/
- Image*
- getImage(const std::string &idPath);
+ Image *getImage(const std::string &idPath);
/**
* Convenience wrapper around ResourceManager::get for loading
* songs.
*/
- Music*
- getMusic(const std::string &idPath);
+ Music *getMusic(const std::string &idPath);
/**
* Convenience wrapper around ResourceManager::get for loading
* samples.
*/
- SoundEffect*
- getSoundEffect(const std::string &idPath);
+ SoundEffect *getSoundEffect(const std::string &idPath);
/**
* Creates a image set based on the image referenced by the given
* path and the supplied sprite sizes
*/
- ImageSet*
- getImageSet(const std::string &imagePath, int w, int h);
+ ImageSet *getImageSet(const std::string &imagePath, int w, int h);
/**
* Creates a sprite definition based on a given path and the supplied
@@ -181,41 +171,35 @@ class ResourceManager
* @return An allocated byte array containing the data that was loaded,
* or <code>NULL</code> on fail.
*/
- void*
- loadFile(const std::string &fileName, int &fileSize);
+ void *loadFile(const std::string &fileName, int &fileSize);
/**
* Retrieves the contents of a text file.
*/
- std::vector<std::string>
- loadTextFile(const std::string &fileName);
+ std::vector<std::string> loadTextFile(const std::string &fileName);
/**
* 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
* already exist.
*/
- static ResourceManager*
- getInstance();
+ static ResourceManager *getInstance();
/**
* Deletes the class instance if it exists.
*/
- static void
- deleteInstance();
+ static void deleteInstance();
private:
/**
* Deletes the resource after logging a cleanup message.
*/
- static void
- cleanUp(Resource *resource);
+ static void cleanUp(Resource *resource);
void cleanOrphans();
diff --git a/src/textparticle.h b/src/textparticle.h
index 3a0ba674..d56dbf84 100644
--- a/src/textparticle.h
+++ b/src/textparticle.h
@@ -37,11 +37,11 @@ class TextParticle : public Particle
TextParticle(Map *map, const std::string &text,
int colorR, int colorG, int colorB,
gcn::Font *font);
+
/**
* Draws the particle image.
*/
- virtual void
- draw(Graphics *graphics, int offsetX, int offsetY) const;
+ virtual void draw(Graphics *graphics, int offsetX, int offsetY) const;
// hack to improve text visibility
virtual int getPixelY() const