add code to debug collision rectangles
[supertux.git] / src / video / texture_manager.cpp
index 73c71fd..9ecba97 100644 (file)
@@ -6,6 +6,7 @@
 #include <SDL.h>
 #include <SDL_image.h>
 #include <GL/gl.h>
+#include <GL/glext.h>
 #include <iostream>
 #include <sstream>
 #include <stdexcept>
@@ -13,6 +14,7 @@
 #include "image_texture.hpp"
 #include "glutil.hpp"
 #include "file_system.hpp"
+#include "log.hpp"
 
 TextureManager* texture_manager = NULL;
 
@@ -26,9 +28,7 @@ TextureManager::~TextureManager()
       i != image_textures.end(); ++i) {
     if(i->second == NULL)
       continue;
-#ifdef DEBUG
-    std::cerr << "Warning: Texture '" << i->first << "' not freed\n";
-#endif
+    log_warning << "Texture '" << i->first << "' not freed" << std::endl;
     delete i->second;
   }
 }
@@ -54,7 +54,7 @@ TextureManager::get(const std::string& _filename)
 void
 TextureManager::release(ImageTexture* texture)
 {
-  image_textures[texture->filename] = NULL;
+  image_textures.erase(texture->filename);
   delete texture;
 }
 
@@ -173,7 +173,7 @@ TextureManager::save_texture(Texture* texture)
   glDeleteTextures(1, &(texture->handle));
   texture->handle = 0;
 
-  assert_gl("retrieving texture");
+  assert_gl("retrieving texture for save");
 }
 
 void