CMapInfo.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 Campaign;
  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<Campaign> campaign; //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 originalFileURI;
  28. std::string fullFileURI;
  29. std::string date;
  30. int amountOfPlayersOnMap;
  31. int amountOfHumanControllablePlayers;
  32. int amountOfHumanPlayersInSave;
  33. bool isRandomMap;
  34. CMapInfo();
  35. virtual ~CMapInfo();
  36. CMapInfo(CMapInfo &&other) = delete;
  37. CMapInfo(const CMapInfo &other) = delete;
  38. CMapInfo &operator=(CMapInfo &&other) = delete;
  39. CMapInfo &operator=(const CMapInfo &other) = delete;
  40. void mapInit(const std::string & fname);
  41. void saveInit(const ResourceID & file);
  42. void campaignInit();
  43. void countPlayers();
  44. // TODO: Those must be on client-side
  45. std::string getName() const;
  46. std::string getNameForList() const;
  47. std::string getDescription() const;
  48. int getMapSizeIconId() const;
  49. int getMapSizeFormatIconId() const;
  50. std::string getMapSizeName() const;
  51. template <typename Handler> void serialize(Handler &h, const int Version)
  52. {
  53. h & mapHeader;
  54. h & campaign;
  55. h & scenarioOptionsOfSave;
  56. h & fileURI;
  57. h & date;
  58. h & amountOfPlayersOnMap;
  59. h & amountOfHumanControllablePlayers;
  60. h & amountOfHumanPlayersInSave;
  61. h & isRandomMap;
  62. }
  63. };
  64. VCMI_LIB_NAMESPACE_END