2012-11-03 16:30:47 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// Forward class declarations aren't enough here. The compiler
|
2015-12-29 04:43:33 +02:00
|
|
|
// generated CMapInfo d-tor, generates the std::unique_ptr d-tor as well here
|
|
|
|
// as a inline method. The std::unique_ptr d-tor requires a complete type. Defining
|
2012-11-03 16:30:47 +03:00
|
|
|
// the CMapInfo d-tor to let the compiler add the d-tor stuff in the .cpp file
|
|
|
|
// would work with one exception. It prevents the generation of the move
|
|
|
|
// constructor which is needed. (Writing such a c-tor is nasty.) With the
|
|
|
|
// new c++11 keyword "default" for constructors this problem could be solved. But it isn't
|
|
|
|
// available for Visual Studio for now. (Empty d-tor in .cpp would be required anyway)
|
|
|
|
#include "CMap.h"
|
|
|
|
#include "CCampaignHandler.h"
|
|
|
|
|
|
|
|
struct StartInfo;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
std::unique_ptr<CCampaignHeader> campaignHeader; //may be nullptr if scenario
|
2012-11-11 15:23:31 +03:00
|
|
|
StartInfo * scenarioOpts; //options with which scenario has been started (used only with saved games)
|
|
|
|
std::string fileURI;
|
|
|
|
std::string date;
|
|
|
|
int playerAmnt; //players in map
|
|
|
|
int humanPlayers; //players ALLOWED to be controlled by human
|
|
|
|
int actualHumanPlayers; // >1 if multiplayer game
|
2012-11-20 20:53:45 +03:00
|
|
|
bool isRandomMap; // true if the map will be created randomly, false if not
|
2012-11-03 16:30:47 +03:00
|
|
|
|
2012-11-11 15:23:31 +03:00
|
|
|
CMapInfo();
|
2013-07-02 15:08:30 +03:00
|
|
|
CMapInfo(CMapInfo && tmp);
|
2016-08-31 05:18:01 +02:00
|
|
|
virtual ~CMapInfo();
|
2013-07-02 15:08:30 +03:00
|
|
|
|
2013-07-02 18:23:32 +03:00
|
|
|
CMapInfo &operator=(CMapInfo &&other);
|
|
|
|
|
2012-11-11 15:23:31 +03:00
|
|
|
void mapInit(const std::string & fname);
|
|
|
|
void campaignInit();
|
|
|
|
void countPlayers();
|
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)
|
|
|
|
{
|
|
|
|
h & mapHeader & campaignHeader & scenarioOpts & fileURI & date & playerAmnt & humanPlayers;
|
2013-01-06 22:30:12 +03:00
|
|
|
h & actualHumanPlayers & isRandomMap;
|
2012-11-11 15:23:31 +03:00
|
|
|
}
|
2012-11-03 16:30:47 +03:00
|
|
|
};
|