MapFormatSettings.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * MapFormatSettings.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. #include "MapIdentifiersH3M.h"
  12. #include "MapFormat.h"
  13. #include "../campaign/CampaignConstants.h"
  14. VCMI_LIB_NAMESPACE_BEGIN
  15. class MapFormatSettings
  16. {
  17. static MapIdentifiersH3M generateMapping(EMapFormat format);
  18. static std::map<EMapFormat, MapIdentifiersH3M> generateMappings();
  19. static std::map<CampaignVersion, EMapFormat> generateCampaignMapping();
  20. std::map<EMapFormat, MapIdentifiersH3M> mapping;
  21. std::map<CampaignVersion, EMapFormat> campaignToMap;
  22. public:
  23. MapFormatSettings();
  24. bool isSupported(EMapFormat format) const
  25. {
  26. return mapping.count(format) != 0;
  27. }
  28. bool isSupported(CampaignVersion format) const
  29. {
  30. return isSupported(campaignToMap.at(format));
  31. }
  32. const MapIdentifiersH3M & getMapping(EMapFormat format) const
  33. {
  34. return mapping.at(format);
  35. }
  36. const MapIdentifiersH3M & getMapping(CampaignVersion format) const
  37. {
  38. return mapping.at(campaignToMap.at(format));
  39. }
  40. };
  41. VCMI_LIB_NAMESPACE_END