[Super-tux-commit] supertux/src resources.cpp,1.27,1.28 setup.cpp,1.62,1.63 setup.h,1.18,1.19 supert
Brought to you by:
wkendrick
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9438/src Modified Files: resources.cpp setup.cpp setup.h supertux.cpp text.cpp texture.cpp title.cpp world.cpp world.h worldmap.cpp Log Message: <MatzeB> fixes some remaining memory leaks Index: text.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/text.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- text.cpp 27 Apr 2004 18:55:57 -0000 1.16 +++ text.cpp 28 Apr 2004 13:18:54 -0000 1.17 @@ -70,6 +70,12 @@ SDL_FreeSurface(conv); } +Text::~Text() +{ + delete chars; + delete shadow_chars; +} + void Text::draw(const char* text, int x, int y, int shadowsize, int update) { @@ -182,14 +188,6 @@ } } -Text::~Text() -{ - if(kind == TEXT_TEXT) - delete chars; - else if(kind == TEXT_NUM) - delete chars; -} - /* --- ERASE TEXT: --- */ void Index: world.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/world.h,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- world.h 26 Apr 2004 10:46:45 -0000 1.31 +++ world.h 28 Apr 2004 13:18:54 -0000 1.32 @@ -57,7 +57,8 @@ std::vector<Upgrade> upgrades; std::vector<Bullet> bullets; - std::vector<ParticleSystem*> particle_systems; + typedef std::vector<ParticleSystem*> ParticleSystems; + ParticleSystems particle_systems; public: static World* current() { return current_; } Index: setup.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/setup.cpp,v retrieving revision 1.62 retrieving revision 1.63 diff -u -d -r1.62 -r1.63 --- setup.cpp 26 Apr 2004 17:35:08 -0000 1.62 +++ setup.cpp 28 Apr 2004 13:18:54 -0000 1.63 @@ -600,7 +600,6 @@ { /* Free global images: */ - delete black_text; delete gold_text; delete white_text; @@ -608,6 +607,7 @@ delete red_text; delete white_small_text; delete white_big_text; + delete yellow_nums; /* Free GUI/menu images: */ delete checkbox; Index: setup.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/setup.h,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- setup.h 20 Apr 2004 11:09:34 -0000 1.18 +++ setup.h 28 Apr 2004 13:18:54 -0000 1.19 @@ -33,6 +33,7 @@ void free_strings(char **strings, int num); void st_directory_setup(void); void st_general_setup(void); +void st_general_free(); void st_video_setup_sdl(void); void st_video_setup_gl(void); void st_video_setup(void); Index: texture.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/texture.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- texture.cpp 26 Apr 2004 12:21:22 -0000 1.16 +++ texture.cpp 28 Apr 2004 13:18:54 -0000 1.17 @@ -20,6 +20,7 @@ #include <assert.h> #include <iostream> +#include <algorithm> #include "SDL.h" #include "SDL_image.h" #include "texture.h" @@ -163,6 +164,17 @@ Surface::~Surface() { +#ifdef DEBUG + bool found = false; + for(std::list<Surface*>::iterator i = surfaces.begin(); i != surfaces.end(); + ++i) { + if(*i == this) { + found = true; break; + } + } + if(!found) + printf("Error: Surface freed twice!!!\n"); +#endif surfaces.remove(this); delete impl; } Index: title.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/title.cpp,v retrieving revision 1.64 retrieving revision 1.65 diff -u -d -r1.64 -r1.65 --- title.cpp 26 Apr 2004 15:03:24 -0000 1.64 +++ title.cpp 28 Apr 2004 13:18:54 -0000 1.65 @@ -362,6 +362,7 @@ delete bkg_title; delete logo; + delete img_choose_subset; } // EOF // Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.60 retrieving revision 1.61 diff -u -d -r1.60 -r1.61 --- worldmap.cpp 27 Apr 2004 19:16:01 -0000 1.60 +++ worldmap.cpp 28 Apr 2004 13:18:54 -0000 1.61 @@ -674,7 +674,7 @@ if (dir != NONE) { tux->set_direction(dir); - tux->update(delta); + //tux->update(delta); } std::cout << "Walk to dir: " << dir << std::endl; @@ -724,8 +724,8 @@ } else { - tux->set_direction(input_direction); tux->update(delta); + tux->set_direction(input_direction); } Menu* menu = Menu::current(); @@ -866,6 +866,9 @@ delta *= 1.3f; + if (delta > 10.0f) + delta = .3f; + last_update_time = update_time; update_time = st_get_ticks(); Index: world.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/world.cpp,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- world.cpp 27 Apr 2004 19:17:15 -0000 1.44 +++ world.cpp 28 Apr 2004 13:18:54 -0000 1.45 @@ -101,6 +101,10 @@ { for (BadGuys::iterator i = bad_guys.begin(); i != bad_guys.end(); ++i) delete *i; + + for (ParticleSystems::iterator i = particle_systems.begin(); + i != particle_systems.end(); ++i) + delete *i; delete level; } Index: supertux.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/supertux.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- supertux.cpp 26 Apr 2004 12:21:22 -0000 1.14 +++ supertux.cpp 28 Apr 2004 13:18:54 -0000 1.15 @@ -65,6 +65,7 @@ updatescreen(); unloadshared(); + st_general_free(); TileManager::destroy_instance(); #ifdef DEBUG Surface::debug_check(); Index: resources.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/resources.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- resources.cpp 26 Apr 2004 12:21:22 -0000 1.27 +++ resources.cpp 28 Apr 2004 13:18:54 -0000 1.28 @@ -218,6 +218,7 @@ for (i = 0; i < 2; i++) delete img_flag[i]; + delete img_red_glow; for (i = 0; i < 4; i++) { delete img_distro[i]; @@ -225,6 +226,8 @@ delete img_cloud[1][i]; } + delete tux_life; + for (i = 0; i < NUM_SOUNDS; i++) free_chunk(sounds[i]); |