4 // Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21 #ifndef HEADER_TILE_MANAGER_HXX
22 #define HEADER_TILE_MANAGER_HXX
35 friend bool operator<(const TileGroup& lhs, const TileGroup& rhs)
36 { return lhs.name < rhs.name; };
37 friend bool operator>(const TileGroup& lhs, const TileGroup& rhs)
38 { return lhs.name > rhs.name; };
41 std::vector<int> tiles;
47 typedef std::vector<Tile*> Tiles;
50 static TileManager* instance_ ;
51 std::set<TileGroup> tilegroups;
53 std::string tiles_path;
55 void load_tileset(std::string filename);
58 TileManager(const std::string& filename);
61 const std::set<TileGroup>& get_tilegroups() const
66 const Tile* get(uint32_t id) const
68 //FIXME: Commenting out tiles in sprites.strf makes tiles.size() fail - it's being set to the first tile commented out.
69 assert(id < tiles.size());
70 Tile* tile = tiles[id];
72 std::cout << "TileManager: Invalid tile: " << id << std::endl;
76 if(tile->images.size() == 0 && tile->imagespecs.size() != 0)
77 tile->load_images(tiles_path);
82 uint32_t get_max_tileid() const
87 int get_default_width() const
92 int get_default_height() const