2017-07-13 10:26:03 +02:00
|
|
|
/*
|
|
|
|
* CMapInfo.h, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
2012-11-03 16:30:47 +03:00
|
|
|
#pragma once
|
|
|
|
|
2022-07-26 15:07:42 +02:00
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
2012-11-03 16:30:47 +03:00
|
|
|
struct StartInfo;
|
|
|
|
|
2023-02-24 22:38:12 +02:00
|
|
|
class CMapHeader;
|
2023-06-26 00:07:55 +02:00
|
|
|
class Campaign;
|
2023-02-24 22:38:12 +02:00
|
|
|
class ResourceID;
|
|
|
|
|
2012-11-03 16:30:47 +03:00
|
|
|
/**
|
|
|
|
* A class which stores the count of human players and all players, the filename,
|
|
|
|
* scenario options, the map header information,...
|
|
|
|
*/
|
|
|
|
class DLL_LINKAGE CMapInfo
|
|
|
|
{
|
|
|
|
public:
|
2015-12-29 04:43:33 +02:00
|
|
|
std::unique_ptr<CMapHeader> mapHeader; //may be nullptr if campaign
|
2023-06-26 00:07:55 +02:00
|
|
|
std::unique_ptr<Campaign> campaign; //may be nullptr if scenario
|
2018-01-05 19:21:07 +02:00
|
|
|
StartInfo * scenarioOptionsOfSave; // Options with which scenario has been started (used only with saved games)
|
2012-11-11 15:23:31 +03:00
|
|
|
std::string fileURI;
|
|
|
|
std::string date;
|
2018-01-05 19:21:07 +02:00
|
|
|
int amountOfPlayersOnMap;
|
|
|
|
int amountOfHumanControllablePlayers;
|
|
|
|
int amountOfHumanPlayersInSave;
|
|
|
|
bool isRandomMap;
|
2012-11-03 16:30:47 +03:00
|
|
|
|
2012-11-11 15:23:31 +03:00
|
|
|
CMapInfo();
|
2016-08-31 05:18:01 +02:00
|
|
|
virtual ~CMapInfo();
|
2013-07-02 15:08:30 +03:00
|
|
|
|
2023-02-24 22:38:12 +02:00
|
|
|
CMapInfo(CMapInfo &&other) = delete;
|
|
|
|
CMapInfo(const CMapInfo &other) = delete;
|
|
|
|
|
|
|
|
CMapInfo &operator=(CMapInfo &&other) = delete;
|
|
|
|
CMapInfo &operator=(const CMapInfo &other) = delete;
|
2013-07-02 18:23:32 +03:00
|
|
|
|
2012-11-11 15:23:31 +03:00
|
|
|
void mapInit(const std::string & fname);
|
2023-02-11 18:30:06 +02:00
|
|
|
void saveInit(const ResourceID & file);
|
2012-11-11 15:23:31 +03:00
|
|
|
void campaignInit();
|
|
|
|
void countPlayers();
|
2018-01-05 19:21:07 +02:00
|
|
|
// TODO: Those must be on client-side
|
|
|
|
std::string getName() const;
|
|
|
|
std::string getNameForList() const;
|
|
|
|
std::string getDescription() const;
|
|
|
|
int getMapSizeIconId() const;
|
2023-05-20 16:34:39 +02:00
|
|
|
int getMapSizeFormatIconId() const;
|
2018-01-05 19:21:07 +02:00
|
|
|
std::string getMapSizeName() const;
|
2012-11-03 16:30:47 +03:00
|
|
|
|
2012-11-11 15:23:31 +03:00
|
|
|
template <typename Handler> void serialize(Handler &h, const int Version)
|
|
|
|
{
|
2017-07-31 15:35:42 +02:00
|
|
|
h & mapHeader;
|
2023-06-26 00:07:55 +02:00
|
|
|
h & campaign;
|
2018-01-05 19:21:07 +02:00
|
|
|
h & scenarioOptionsOfSave;
|
2017-07-31 15:35:42 +02:00
|
|
|
h & fileURI;
|
|
|
|
h & date;
|
2018-01-05 19:21:07 +02:00
|
|
|
h & amountOfPlayersOnMap;
|
|
|
|
h & amountOfHumanControllablePlayers;
|
|
|
|
h & amountOfHumanPlayersInSave;
|
2017-07-31 15:35:42 +02:00
|
|
|
h & isRandomMap;
|
2012-11-11 15:23:31 +03:00
|
|
|
}
|
2012-11-03 16:30:47 +03:00
|
|
|
};
|
2022-07-26 15:07:42 +02:00
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_END
|