// $Id$
//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <grumbel@gmx.de>
+// SuperTux
+// Copyright (C) 2004 Ingo Ruhnke <grumbel@gmx.de>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
load_resfile(filename);
}
+SpriteManager::~SpriteManager()
+{
+ for(std::map<std::string, Sprite*>::iterator i = sprites.begin();
+ i != sprites.end(); ++i) {
+ delete i->second;
+ }
+}
+
void
SpriteManager::load_resfile(const std::string& filename)
{
- lisp_object_t* cur = lisp_read_from_file(filename);
+ lisp_object_t* root_obj = lisp_read_from_file(filename);
+ if (!root_obj)
+ {
+ std::cout << "SpriteManager: Couldn't load: " << filename << std::endl;
+ return;
+ }
+
+ lisp_object_t* cur = root_obj;
if (strcmp(lisp_symbol(lisp_car(cur)), "supertux-resources") != 0)
return;
cur = lisp_cdr(cur);
}
+
+ lisp_free(root_obj);
}
Sprite*