diff options
Diffstat (limited to 'src/resources/resourcemanager.cpp')
-rw-r--r-- | src/resources/resourcemanager.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp index d6ab39a0..33d5e3e5 100644 --- a/src/resources/resourcemanager.cpp +++ b/src/resources/resourcemanager.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,17 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "resources/resourcemanager.h" + +#include "resources/dye.h" +#include "resources/image.h" +#include "resources/imageset.h" +#include "resources/music.h" +#include "resources/soundeffect.h" +#include "resources/spritedef.h" + +#include "log.h" + #include <cassert> #include <physfs.h> #include <SDL_image.h> @@ -27,16 +37,6 @@ #include <sys/time.h> -#include "dye.h" -#include "image.h" -#include "imageset.h" -#include "music.h" -#include "resourcemanager.h" -#include "soundeffect.h" -#include "spritedef.h" - -#include "../log.h" - ResourceManager *ResourceManager::instance = NULL; ResourceManager::ResourceManager() @@ -214,7 +214,7 @@ std::string ResourceManager::getPath(const std::string &file) return path; } -Resource *ResourceManager::get(std::string const &idPath, generator fun, +Resource *ResourceManager::get(const std::string &idPath, generator fun, void *data) { // Check if the id exists, and return the value if it does. @@ -266,7 +266,7 @@ struct ResourceLoader } }; -Resource *ResourceManager::load(std::string const &path, loader fun) +Resource *ResourceManager::load(const std::string &path, loader fun) { ResourceLoader l = { this, path, fun }; return get(path, ResourceLoader::load, &l); @@ -308,7 +308,7 @@ struct DyedImageLoader } }; -Image *ResourceManager::getImage(std::string const &idPath) +Image *ResourceManager::getImage(const std::string &idPath) { DyedImageLoader l = { this, idPath }; return static_cast<Image*>(get(idPath, DyedImageLoader::load, &l)); @@ -350,8 +350,7 @@ struct SpriteDefLoader } }; -SpriteDef *ResourceManager::getSprite - (std::string const &path, int variant) +SpriteDef *ResourceManager::getSprite(const std::string &path, int variant) { SpriteDefLoader l = { path, variant }; std::stringstream ss; @@ -380,7 +379,8 @@ void ResourceManager::release(Resource *res) ResourceManager *ResourceManager::getInstance() { // Create a new instance if necessary. - if (instance == NULL) instance = new ResourceManager(); + if (!instance) + instance = new ResourceManager; return instance; } @@ -441,7 +441,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); |