]> git.localhorst.tv Git - blank.git/blob - src/world/BlockTypeRegistry.hpp
special treatment for players
[blank.git] / src / world / BlockTypeRegistry.hpp
1 #ifndef BLANK_WORLD_BLOCKTYPEREGISTRY_HPP_
2 #define BLANK_WORLD_BLOCKTYPEREGISTRY_HPP_
3
4 #include "BlockType.hpp"
5
6 #include <vector>
7
8
9 namespace blank {
10
11 class BlockTypeRegistry {
12
13 public:
14         BlockTypeRegistry();
15
16 public:
17         Block::Type Add(const BlockType &);
18
19         size_t Size() const noexcept { return types.size(); }
20
21         BlockType &operator [](Block::Type id) { return types[id]; }
22         const BlockType &operator [](Block::Type id) const { return types[id]; }
23
24         BlockType &Get(Block::Type id) { return types[id]; }
25         const BlockType &Get(Block::Type id) const { return types[id]; }
26
27 private:
28         std::vector<BlockType> types;
29
30 };
31
32 }
33
34 #endif