CMapInfo.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * CMapInfo.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. struct StartInfo;
  13. class CMapHeader;
  14. class CampaignHeader;
  15. class ResourceID;
  16. /**
  17. * A class which stores the count of human players and all players, the filename,
  18. * scenario options, the map header information,...
  19. */
  20. class DLL_LINKAGE CMapInfo
  21. {
  22. public:
  23. std::unique_ptr<CMapHeader> mapHeader; //may be nullptr if campaign
  24. std::unique_ptr<CampaignHeader> campaignHeader; //may be nullptr if scenario
  25. StartInfo * scenarioOptionsOfSave; // Options with which scenario has been started (used only with saved games)
  26. std::string fileURI;
  27. std::string date;
  28. int amountOfPlayersOnMap;
  29. int amountOfHumanControllablePlayers;
  30. int amountOfHumanPlayersInSave;
  31. bool isRandomMap;
  32. CMapInfo();
  33. virtual ~CMapInfo();
  34. CMapInfo(CMapInfo &&other) = delete;
  35. CMapInfo(const CMapInfo &other) = delete;
  36. CMapInfo &operator=(CMapInfo &&other) = delete;
  37. CMapInfo &operator=(const CMapInfo &other) = delete;
  38. void mapInit(const std::string & fname);
  39. void saveInit(const ResourceID & file);
  40. void campaignInit();
  41. void countPlayers();
  42. // TODO: Those must be on client-side
  43. std::string getName() const;
  44. std::string getNameForList() const;
  45. std::string getDescription() const;
  46. int getMapSizeIconId() const;
  47. int getMapSizeFormatIconId() const;
  48. std::string getMapSizeName() const;
  49. template <typename Handler> void serialize(Handler &h, const int Version)
  50. {
  51. h & mapHeader;
  52. h & campaignHeader;
  53. h & scenarioOptionsOfSave;
  54. h & fileURI;
  55. h & date;
  56. h & amountOfPlayersOnMap;
  57. h & amountOfHumanControllablePlayers;
  58. h & amountOfHumanPlayersInSave;
  59. h & isRandomMap;
  60. }
  61. };
  62. VCMI_LIB_NAMESPACE_END