2015-12-02 21:39:53 +02:00
|
|
|
/*
|
|
|
|
* CPlayerState.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
|
|
|
|
*
|
|
|
|
*/
|
2017-07-13 10:26:03 +02:00
|
|
|
#pragma once
|
2015-12-02 21:39:53 +02:00
|
|
|
|
|
|
|
#include "HeroBonus.h"
|
|
|
|
|
|
|
|
class CGHeroInstance;
|
|
|
|
class CGTownInstance;
|
|
|
|
class CGDwelling;
|
|
|
|
|
|
|
|
struct DLL_LINKAGE PlayerState : public CBonusSystemNode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PlayerColor color;
|
|
|
|
bool human; //true if human controlled player, false for AI
|
|
|
|
TeamID team;
|
|
|
|
TResources resources;
|
|
|
|
std::set<ObjectInstanceID> visitedObjects; // as a std::set, since most accesses here will be from visited status checks
|
|
|
|
std::vector<ConstTransitivePtr<CGHeroInstance> > heroes;
|
|
|
|
std::vector<ConstTransitivePtr<CGTownInstance> > towns;
|
|
|
|
std::vector<ConstTransitivePtr<CGHeroInstance> > availableHeroes; //heroes available in taverns
|
|
|
|
std::vector<ConstTransitivePtr<CGDwelling> > dwellings; //used for town growth
|
|
|
|
std::vector<QuestInfo> quests; //store info about all received quests
|
|
|
|
|
|
|
|
bool enteredWinningCheatCode, enteredLosingCheatCode; //if true, this player has entered cheat codes for loss / victory
|
|
|
|
EPlayerStatus::EStatus status;
|
|
|
|
boost::optional<ui8> daysWithoutCastle;
|
|
|
|
|
|
|
|
PlayerState();
|
2016-07-29 11:27:55 +02:00
|
|
|
PlayerState(PlayerState && other);
|
|
|
|
|
2015-12-02 21:39:53 +02:00
|
|
|
std::string nodeName() const override;
|
|
|
|
|
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
2017-07-31 15:35:42 +02:00
|
|
|
h & color;
|
|
|
|
h & human;
|
|
|
|
h & team;
|
|
|
|
h & resources;
|
|
|
|
h & status;
|
|
|
|
h & heroes;
|
|
|
|
h & towns;
|
|
|
|
h & availableHeroes;
|
|
|
|
h & dwellings;
|
|
|
|
h & quests;
|
|
|
|
h & visitedObjects;
|
2016-09-04 12:43:09 +02:00
|
|
|
|
|
|
|
if(version < 760)
|
|
|
|
{
|
|
|
|
//was: h & getBonusList();
|
|
|
|
BonusList junk;
|
|
|
|
h & junk;
|
|
|
|
}
|
|
|
|
|
2017-07-31 15:35:42 +02:00
|
|
|
h & status;
|
|
|
|
h & daysWithoutCastle;
|
|
|
|
h & enteredLosingCheatCode;
|
|
|
|
h & enteredWinningCheatCode;
|
2015-12-02 21:39:53 +02:00
|
|
|
h & static_cast<CBonusSystemNode&>(*this);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct DLL_LINKAGE TeamState : public CBonusSystemNode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TeamID id; //position in gameState::teams
|
|
|
|
std::set<PlayerColor> players; // members of this team
|
2016-12-12 22:38:12 +02:00
|
|
|
//TODO: boost::array, bool if possible
|
2015-12-02 21:39:53 +02:00
|
|
|
std::vector<std::vector<std::vector<ui8> > > fogOfWarMap; //true - visible, false - hidden
|
|
|
|
|
|
|
|
TeamState();
|
2016-07-29 11:27:55 +02:00
|
|
|
TeamState(TeamState && other);
|
2015-12-02 21:39:53 +02:00
|
|
|
|
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
2017-07-31 15:35:42 +02:00
|
|
|
h & id;
|
|
|
|
h & players;
|
|
|
|
h & fogOfWarMap;
|
2015-12-02 21:39:53 +02:00
|
|
|
h & static_cast<CBonusSystemNode&>(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|