[Super-tux-commit] supertux/src badguy.cpp,1.103,1.104 collision.cpp,1.26,1.27 sector.cpp,1.3,1.4
Brought to you by:
wkendrick
From: Ryan F. <sik...@us...> - 2004-06-01 21:09:48
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23803 Modified Files: badguy.cpp collision.cpp sector.cpp Log Message: - fixed some crashes where there was an invalid tile number - some tiles need to be fixed (ie, there is no tile 6 but level5 and others contain it) Index: badguy.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy.cpp,v retrieving revision 1.103 retrieving revision 1.104 diff -u -d -r1.103 -r1.104 --- badguy.cpp 1 Jun 2004 06:58:34 -0000 1.103 +++ badguy.cpp 1 Jun 2004 21:09:37 -0000 1.104 @@ -644,7 +644,8 @@ // go in wait mode when back in water if(dying == DYING_NOT - && gettile(base.x, base.y+ base.height)->attributes & Tile::WATER + && gettile(base.x, base.y + base.height) + && gettile(base.x, base.y + base.height)->attributes & Tile::WATER && physic.get_velocity_y() <= 0 && mode == NORMAL) { mode = FISH_WAIT; Index: collision.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/collision.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- collision.cpp 31 May 2004 02:40:29 -0000 1.26 +++ collision.cpp 1 Jun 2004 21:09:37 -0000 1.27 @@ -55,7 +55,7 @@ for(int x = starttilex; x*32 < max_x; ++x) { for(int y = starttiley; y*32 < max_y; ++y) { Tile* tile = tilemap.get_tile(x, y); - if(tile->attributes & Tile::SOLID) + if(tile && tile->attributes & Tile::SOLID) return true; } } Index: sector.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sector.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- sector.cpp 31 May 2004 22:13:15 -0000 1.3 +++ sector.cpp 1 Jun 2004 21:09:37 -0000 1.4 @@ -618,6 +618,13 @@ Sector::trybreakbrick(const Vector& pos, bool small) { Tile* tile = solids->get_tile_at(pos); + if (!tile) + { + char errmsg[64]; + sprintf(errmsg, "Invalid tile at %i,%i", (int)((pos.x+1)/32*32), (int)((pos.y+1)/32*32)); + throw SuperTuxException(errmsg, __FILE__, __LINE__); + } + if (tile->attributes & Tile::BRICK) { if (tile->data > 0) @@ -674,6 +681,14 @@ Sector::tryemptybox(const Vector& pos, Direction col_side) { Tile* tile = solids->get_tile_at(pos); + if (!tile) + { + char errmsg[64]; + sprintf(errmsg, "Invalid tile at %i,%i", (int)((pos.x+1)/32*32), (int)((pos.y+1)/32*32)); + throw SuperTuxException(errmsg, __FILE__, __LINE__); + } + + if (!(tile->attributes & Tile::FULLBOX)) return; @@ -730,6 +745,14 @@ Sector::trygrabdistro(const Vector& pos, int bounciness) { Tile* tile = solids->get_tile_at(pos); + if (!tile) + { + char errmsg[64]; + sprintf(errmsg, "Invalid tile at %i,%i", (int)((pos.x+1)/32*32), (int)((pos.y+1)/32*32)); + throw SuperTuxException(errmsg, __FILE__, __LINE__); + } + + if (!(tile->attributes & Tile::COIN)) return; |