projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
improve exception feedback a bit
[supertux.git]
/
src
/
tile_manager.h
diff --git
a/src/tile_manager.h
b/src/tile_manager.h
index
a55fcb8
..
e05f6b3
100644
(file)
--- a/
src/tile_manager.h
+++ b/
src/tile_manager.h
@@
-24,6
+24,7
@@
#include <set>
#include <vector>
#include <string>
#include <set>
#include <vector>
#include <string>
+#include <map>
class Tile;
class Tile;
@@
-44,7
+45,9
@@
class TileManager
TileManager();
~TileManager();
TileManager();
~TileManager();
- std::vector<Tile*> tiles;
+ typedef std::map<int, Tile*> Tiles;
+ Tiles tiles;
+
static TileManager* instance_ ;
static std::set<TileGroup>* tilegroups_;
void load_tileset(std::string filename);
static TileManager* instance_ ;
static std::set<TileGroup>* tilegroups_;
void load_tileset(std::string filename);
@@
-61,20
+64,11
@@
class TileManager
const Vector& pos, int layer);
static std::set<TileGroup>* tilegroups() { if(!instance_) { instance_ = new TileManager(); } return tilegroups_ ? tilegroups_ : tilegroups_ = new std::set<TileGroup>; }
const Vector& pos, int layer);
static std::set<TileGroup>* tilegroups() { if(!instance_) { instance_ = new TileManager(); } return tilegroups_ ? tilegroups_ : tilegroups_ = new std::set<TileGroup>; }
- Tile& get(unsigned int id) {
- if(id < tiles.size())
- {
- return *tiles[id];
- }
- else
- {
- // Never return 0, but return the 0th tile instead so that
- // user code doesn't have to check for NULL pointers all over
- // the place
- return *tiles[0];
- }
- }
+ unsigned int total_ids()
+ { return tiles.size(); }
+
+ Tile* get(unsigned int id);
};
#endif
};
#endif