CPlayerState.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #pragma once
  2. /*
  3. * CPlayerState.h, part of VCMI engine
  4. *
  5. * Authors: listed in file AUTHORS in main folder
  6. *
  7. * License: GNU General Public License v2.0 or later
  8. * Full text of license available in license.txt file, in main folder
  9. *
  10. */
  11. #include "HeroBonus.h"
  12. class CGHeroInstance;
  13. class CGTownInstance;
  14. class CGDwelling;
  15. struct DLL_LINKAGE PlayerState : public CBonusSystemNode
  16. {
  17. public:
  18. PlayerColor color;
  19. bool human; //true if human controlled player, false for AI
  20. TeamID team;
  21. TResources resources;
  22. std::set<ObjectInstanceID> visitedObjects; // as a std::set, since most accesses here will be from visited status checks
  23. std::vector<ConstTransitivePtr<CGHeroInstance> > heroes;
  24. std::vector<ConstTransitivePtr<CGTownInstance> > towns;
  25. std::vector<ConstTransitivePtr<CGHeroInstance> > availableHeroes; //heroes available in taverns
  26. std::vector<ConstTransitivePtr<CGDwelling> > dwellings; //used for town growth
  27. std::vector<QuestInfo> quests; //store info about all received quests
  28. bool enteredWinningCheatCode, enteredLosingCheatCode; //if true, this player has entered cheat codes for loss / victory
  29. EPlayerStatus::EStatus status;
  30. boost::optional<ui8> daysWithoutCastle;
  31. PlayerState();
  32. std::string nodeName() const override;
  33. template <typename Handler> void serialize(Handler &h, const int version)
  34. {
  35. h & color & human & team & resources & status;
  36. h & heroes & towns & availableHeroes & dwellings & quests & visitedObjects;
  37. h & getBonusList(); //FIXME FIXME FIXME
  38. h & status & daysWithoutCastle;
  39. h & enteredLosingCheatCode & enteredWinningCheatCode;
  40. h & static_cast<CBonusSystemNode&>(*this);
  41. }
  42. };
  43. struct DLL_LINKAGE TeamState : public CBonusSystemNode
  44. {
  45. public:
  46. TeamID id; //position in gameState::teams
  47. std::set<PlayerColor> players; // members of this team
  48. std::vector<std::vector<std::vector<ui8> > > fogOfWarMap; //true - visible, false - hidden
  49. TeamState();
  50. template <typename Handler> void serialize(Handler &h, const int version)
  51. {
  52. h & id & players & fogOfWarMap;
  53. h & static_cast<CBonusSystemNode&>(*this);
  54. }
  55. };