X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Ftile_manager.cpp;h=bbc3cffe73d1fd28c20835192a57f531e6f5eedc;hb=4a486d92343d1824b311c234e9321e08f280fe68;hp=c9db17fc1bfdd208be72a1d6c259a5e8abd5ca5f;hpb=70fdbd45026801f0f0f312278c69b383eaca9d3a;p=supertux.git diff --git a/src/tile_manager.cpp b/src/tile_manager.cpp index c9db17fc1..bbc3cffe7 100644 --- a/src/tile_manager.cpp +++ b/src/tile_manager.cpp @@ -1,7 +1,8 @@ // $Id$ -// +// // SuperTux // Copyright (C) 2004 Tobias Glaesser +// Copyright (C) 2006 Matthias Braun // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -12,7 +13,7 @@ // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -26,6 +27,7 @@ #include #include #include "video/drawing_context.hpp" +#include "log.hpp" #include "lisp/lisp.hpp" #include "lisp/parser.hpp" #include "lisp/list_iterator.hpp" @@ -33,6 +35,8 @@ #include "tile_manager.hpp" #include "resources.hpp" +TileManager* tile_manager = NULL; + TileManager::TileManager(const std::string& filename) { #ifdef DEBUG @@ -40,7 +44,7 @@ TileManager::TileManager(const std::string& filename) #endif load_tileset(filename); #ifdef DEBUG - printf("Tiles loaded in %f seconds\n", (SDL_GetTicks() - ticks) / 1000.0); + log_debug << "Tiles loaded in " << (SDL_GetTicks() - ticks) / 1000.0 << " seconds" << std::endl; #endif } @@ -63,7 +67,7 @@ void TileManager::load_tileset(std::string filename) } else { tiles_path = filename.substr(0, t+1); } - + lisp::Parser parser; std::auto_ptr root (parser.parse(filename)); @@ -80,7 +84,7 @@ void TileManager::load_tileset(std::string filename) tiles.push_back(0); } if(tiles[tile->id] != 0) { - std::cout << "Warning: Tile with ID " << tile->id << " redefined\n"; + log_warning << "Tile with ID " << tile->id << " redefined" << std::endl; } tiles[tile->id] = tile; } else if(iter.item() == "tilegroup") { @@ -97,7 +101,7 @@ void TileManager::load_tileset(std::string filename) std::string image; // width and height of the image in tile units, this is used for two - // purposes: + // purposes: // a) so we don't have to load the image here to know its dimensions // b) so that the resulting 'tiles' entry is more robust, // ie. enlarging the image won't break the tile id mapping @@ -133,12 +137,11 @@ void TileManager::load_tileset(std::string filename) tiles[ids[i]] = tile; } } - + } else if(iter.item() == "properties") { // deprecated } else { - std::cerr << "Unknown symbol '" << iter.item() << "' tile defintion file.\n"; + log_warning << "Unknown symbol '" << iter.item() << "' tile defintion file" << std::endl; } } } -