summaryrefslogtreecommitdiff
path: root/src/resources/resourcemanager.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2008-12-08 20:58:10 +0100
committerIra Rice <irarice@gmail.com>2008-12-08 13:48:10 -0700
commit48c3263aa2540cd895b72edb0337e0717e136e3a (patch)
treef5b93df0b4bf209e73876161c30ef5fe4a00ff3b /src/resources/resourcemanager.cpp
parent81cdc7b2d880f44df6e0a6de74183f36c53836a0 (diff)
downloadmana-48c3263aa2540cd895b72edb0337e0717e136e3a.tar.gz
mana-48c3263aa2540cd895b72edb0337e0717e136e3a.tar.bz2
mana-48c3263aa2540cd895b72edb0337e0717e136e3a.tar.xz
mana-48c3263aa2540cd895b72edb0337e0717e136e3a.zip
Code reformatting
I wish I had never fallen for this weird style, and I hope removing it will prevent others from introducing new code like this. :-)
Diffstat (limited to 'src/resources/resourcemanager.cpp')
-rw-r--r--src/resources/resourcemanager.cpp49
1 files changed, 18 insertions, 31 deletions
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 510a16bd..a317e445 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -91,8 +91,7 @@ ResourceManager::~ResourceManager()
}
}
-void
-ResourceManager::cleanUp(Resource *res)
+void ResourceManager::cleanUp(Resource *res)
{
if (res->mRefCount > 0)
{
@@ -138,14 +137,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)) {
@@ -155,8 +152,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)
{
@@ -182,26 +178,22 @@ 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());
@@ -221,7 +213,8 @@ ResourceManager::getPath(const std::string &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);
@@ -278,14 +271,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));
}
@@ -338,8 +329,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;
@@ -385,23 +376,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());
@@ -453,8 +441,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);