From a8efabdbbd82b92520c90272ea3a933ef7a27fba Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Wed, 29 Mar 2006 21:29:00 +0000 Subject: [PATCH] sprites.strf is gone, woohoo, thanks to Christoph SVN-Revision: 3126 --- data/images/sprites.strf | 8 -------- src/resources.cpp | 2 +- src/sprite/sprite_manager.cpp | 46 +------------------------------------------ src/sprite/sprite_manager.hpp | 3 +-- 4 files changed, 3 insertions(+), 56 deletions(-) delete mode 100644 data/images/sprites.strf diff --git a/data/images/sprites.strf b/data/images/sprites.strf deleted file mode 100644 index 8aa48d8c2..000000000 --- a/data/images/sprites.strf +++ /dev/null @@ -1,8 +0,0 @@ -;; -*- mode: scheme; -*- -(supertux-resources - -;; All sprites are in seperate .sprite files -(ignore-me) - -) - diff --git a/src/resources.cpp b/src/resources.cpp index 7d909b651..933185121 100644 --- a/src/resources.cpp +++ b/src/resources.cpp @@ -75,7 +75,7 @@ void load_shared() Button::info_font = white_small_text; - sprite_manager = new SpriteManager("images/sprites.strf"); + sprite_manager = new SpriteManager(); tile_manager = new TileManager("images/tiles.strf"); /* Tuxes: */ diff --git a/src/sprite/sprite_manager.cpp b/src/sprite/sprite_manager.cpp index e6ab67f90..71e9d3f58 100644 --- a/src/sprite/sprite_manager.cpp +++ b/src/sprite/sprite_manager.cpp @@ -31,15 +31,8 @@ #include "file_system.hpp" #include "msg.hpp" -SpriteManager::SpriteManager(const std::string& filename) +SpriteManager::SpriteManager() { -#ifdef DEBUG - Uint32 ticks = SDL_GetTicks(); -#endif - load_resfile(filename); -#ifdef DEBUG - msg_debug("Loaded sprites in " << (SDL_GetTicks() - ticks) / 1000.0f << " seconds"); -#endif } SpriteManager::~SpriteManager() @@ -49,43 +42,6 @@ SpriteManager::~SpriteManager() } } -void -SpriteManager::load_resfile(const std::string& filename) -{ - lisp::Parser parser; - try { - std::auto_ptr root (parser.parse(filename)); - - const lisp::Lisp* resources = root->get_lisp("supertux-resources"); - if(!resources) - throw std::runtime_error("file is not a supertux-resources files"); - - lisp::ListIterator iter(resources); - while(iter.next()) { - if(iter.item() == "sprite") { - SpriteData* spritedata = new SpriteData(iter.lisp(), "images/"); - - Sprites::iterator i = sprites.find(spritedata->get_name()); - if (i == sprites.end()) { - sprites[spritedata->get_name()] = spritedata; - } else { - delete i->second; - i->second = spritedata; - msg_warning("dulpicate entry: '" << spritedata->get_name() - << "' in spritefile."); - } - } else { - msg_warning("Unknown tag '" << iter.item() - << "' in spritefile."); - } - } - } catch(std::exception& e) { - std::stringstream msg; - msg << "Couldn't load file '" << filename << "': " << e.what() << "\n"; - throw std::runtime_error(msg.str()); - } -} - Sprite* SpriteManager::create(const std::string& name) { diff --git a/src/sprite/sprite_manager.hpp b/src/sprite/sprite_manager.hpp index 01ec93099..ac84da503 100644 --- a/src/sprite/sprite_manager.hpp +++ b/src/sprite/sprite_manager.hpp @@ -32,10 +32,9 @@ private: Sprites sprites; public: - SpriteManager(const std::string& filename); + SpriteManager(); ~SpriteManager(); - void load_resfile(const std::string& filename); /** loads a sprite. */ Sprite* create(const std::string& filename); -- 2.11.0