ModIncompatibility.h 932 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * ModIncompatibility.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. VCMI_LIB_NAMESPACE_BEGIN
  12. class DLL_LINKAGE ModIncompatibility: public std::exception
  13. {
  14. public:
  15. using StringPair = std::pair<const std::string, const std::string>;
  16. using ModList = std::list<StringPair>;
  17. ModIncompatibility(ModList && _missingMods):
  18. missingMods(std::move(_missingMods))
  19. {
  20. std::ostringstream _ss;
  21. for(const auto & m : missingMods)
  22. _ss << m.first << ' ' << m.second << std::endl;
  23. message = _ss.str();
  24. }
  25. const char * what() const noexcept override
  26. {
  27. return message.c_str();
  28. }
  29. private:
  30. //list of mods required to load the game
  31. // first: mod name
  32. // second: mod version
  33. const ModList missingMods;
  34. std::string message;
  35. };
  36. VCMI_LIB_NAMESPACE_END