BlockRegistry.cpp 470 B

123456789101112131415161718192021222324
  1. #include "BlockRegistry.h"
  2. Block BlockRegistry::NULL_BLOCK(0);
  3. BlockRegistry::BlockRegistry() : idCounter(1)
  4. {
  5. }
  6. const Block& BlockRegistry::getBlock(const std::string& name) const
  7. {
  8. const std::unordered_map<std::string, Block>::const_iterator& iter = registry.find(name);
  9. if(iter == registry.end())
  10. {
  11. return NULL_BLOCK;
  12. }
  13. return iter->second;
  14. }
  15. const Block& BlockRegistry::getBlock(BlockId id) const
  16. {
  17. return NULL_BLOCK;
  18. }