/* * 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 * */ #pragma once #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 visitedObjects; // as a std::set, since most accesses here will be from visited status checks std::vector > heroes; std::vector > towns; std::vector > availableHeroes; //heroes available in taverns std::vector > dwellings; //used for town growth std::vector 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 daysWithoutCastle; PlayerState(); PlayerState(PlayerState && other); std::string nodeName() const override; template void serialize(Handler &h, const int version) { h & color; h & human; h & team; h & resources; h & status; h & heroes; h & towns; h & availableHeroes; h & dwellings; h & quests; h & visitedObjects; if(version < 760) { //was: h & getBonusList(); BonusList junk; h & junk; } h & status; h & daysWithoutCastle; h & enteredLosingCheatCode; h & enteredWinningCheatCode; h & static_cast(*this); } }; struct DLL_LINKAGE TeamState : public CBonusSystemNode { public: TeamID id; //position in gameState::teams std::set players; // members of this team //TODO: boost::array, bool if possible std::vector > > fogOfWarMap; //true - visible, false - hidden TeamState(); TeamState(TeamState && other); template void serialize(Handler &h, const int version) { h & id; h & players; h & fogOfWarMap; h & static_cast(*this); } };