2
0

itemgroup.h 443 B

123456789101112131415161718
  1. // Luanti
  2. // SPDX-License-Identifier: LGPL-2.1-or-later
  3. // Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
  4. #pragma once
  5. #include <string>
  6. #include <unordered_map>
  7. typedef std::unordered_map<std::string, int> ItemGroupList;
  8. static inline int itemgroup_get(const ItemGroupList &groups, const std::string &name)
  9. {
  10. ItemGroupList::const_iterator i = groups.find(name);
  11. if (i == groups.end())
  12. return 0;
  13. return i->second;
  14. }