[Super-tux-commit] supertux/src tile_manager.cpp,1.6,1.7 tilemap.cpp,1.18,1.19
Brought to you by:
wkendrick
From: Ricardo C. <rm...@us...> - 2004-10-07 17:10:41
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv876/src Modified Files: tile_manager.cpp tilemap.cpp Log Message: Two leveleditor related bug fixes: - don't show empty tiles on tiles board; - don't show weird tiles when viewing stuff outside the level margins. Index: tile_manager.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/tile_manager.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- tile_manager.cpp 6 Aug 2004 17:37:56 -0000 1.6 +++ tile_manager.cpp 7 Oct 2004 17:10:20 -0000 1.7 @@ -152,16 +152,8 @@ TileManager::get(unsigned int id) { Tiles::iterator i = tiles.find(id); - if(i == tiles.end()) - { - std::cerr << "Warning: Asked for a non-existing tile id. Ignoring.\n"; - // Never return 0, but return the first tile instead so that - // user code doesn't have to check for NULL pointers all over - // the place - i = tiles.begin(); - return i->second; - } + return 0; return i->second; } Index: tilemap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/tilemap.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- tilemap.cpp 5 Aug 2004 18:58:08 -0000 1.18 +++ tilemap.cpp 7 Oct 2004 17:10:28 -0000 1.19 @@ -155,6 +155,8 @@ int tx, ty; for(pos.x = start_x, tx = tsx; pos.x < end_x; pos.x += 32, ++tx) { for(pos.y = start_y, ty = tsy; pos.y < end_y; pos.y += 32, ++ty) { + if(tx < 0 || tx > width || ty < 0 || ty > height) + continue; // outside tilemap if (!tiles[ty*width + tx].hidden) tilemanager->draw_tile(context, tiles[ty*width + tx].id, pos, layer); } @@ -186,6 +188,8 @@ int tx, ty; for(pos.x = start_x, tx = tsx; pos.x < end_x; pos.x += 32, ++tx) { for(pos.y = start_y, ty = tsy; pos.y < end_y; pos.y += 32, ++ty) { + if(tx < 0 || tx > width || ty < 0 || ty > height) + continue; // outside tilemap if (!tiles[ty*width + tx].hidden) tilemanager->draw_tile(context, tiles[ty*width + tx].id, pos, layer); } |