X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Ftile_manager.cpp;h=309311e3e55929ccf4e293929b49337b32f33d9a;hb=850855bb178f8325762e7c9b1db94118cd48ad5c;hp=e6a3a155bd4dd87b5f017bb456c77a9a90ec8847;hpb=f47014ecf483f4589651397f34cdb738892ff582;p=supertux.git diff --git a/src/tile_manager.cpp b/src/tile_manager.cpp index e6a3a155b..309311e3e 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 @@ -24,7 +25,9 @@ #include #include #include +#include #include "video/drawing_context.hpp" +#include "log.hpp" #include "lisp/lisp.hpp" #include "lisp/parser.hpp" #include "lisp/list_iterator.hpp" @@ -32,9 +35,17 @@ #include "tile_manager.hpp" #include "resources.hpp" +TileManager* tile_manager = NULL; + TileManager::TileManager(const std::string& filename) { +#ifdef DEBUG + Uint32 ticks = SDL_GetTicks(); +#endif load_tileset(filename); +#ifdef DEBUG + log_debug << "Tiles loaded in " << (SDL_GetTicks() - ticks) / 1000.0 << " seconds" << std::endl; +#endif } TileManager::~TileManager() @@ -72,6 +83,9 @@ void TileManager::load_tileset(std::string filename) while(tile->id >= tiles.size()) { tiles.push_back(0); } + if(tiles[tile->id] != 0) { + log_warning << "Tile with ID " << tile->id << " redefined" << std::endl; + } tiles[tile->id] = tile; } else if(iter.item() == "tilegroup") { TileGroup tilegroup; @@ -127,7 +141,7 @@ void TileManager::load_tileset(std::string filename) } 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; } } }