4 // Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
5 // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License
9 // as published by the Free Software Foundation; either version 2
10 // of the License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22 #ifndef HEADER_TILE_MANAGER_HXX
23 #define HEADER_TILE_MANAGER_HXX
37 friend bool operator<(const TileGroup& lhs, const TileGroup& rhs)
38 { return lhs.name < rhs.name; };
39 friend bool operator>(const TileGroup& lhs, const TileGroup& rhs)
40 { return lhs.name > rhs.name; };
43 std::vector<int> tiles;
49 typedef std::vector<Tile*> Tiles;
52 static TileManager* instance_ ;
53 std::set<TileGroup> tilegroups;
55 std::string tiles_path;
57 void load_tileset(std::string filename);
60 TileManager(const std::string& filename);
63 const std::set<TileGroup>& get_tilegroups() const
68 const Tile* get(uint32_t id) const
70 //FIXME: Commenting out tiles in sprites.strf makes tiles.size() fail - it's being set to the first tile commented out.
71 assert(id < tiles.size());
72 Tile* tile = tiles[id];
74 log_warning << "Invalid tile: " << id << std::endl;
78 if(tile->images.size() == 0 && tile->imagespecs.size() != 0)
79 tile->load_images(tiles_path);
84 uint32_t get_max_tileid() const
89 int get_default_width() const
94 int get_default_height() const
100 extern TileManager* tile_manager;