]> git.localhorst.tv Git - blank.git/blob - src/world/BlockTypeRegistry.hpp
some code reorganization
[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 &Get(Block::Type id) const { return types[id]; }
23
24 private:
25         std::vector<BlockType> types;
26
27 };
28
29 }
30
31 #endif