InfoAboutArmy.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * InfoAboutArmy.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "../mapObjects/army/CStackBasicDescriptor.h"
  12. VCMI_LIB_NAMESPACE_BEGIN
  13. class CGTownInstance;
  14. class CHeroClass;
  15. class CTown;
  16. //numbers of creatures are exact numbers if detailed else they are quantity ids (1 - a few, 2 - several and so on; additionally 0 - unknown)
  17. struct ArmyDescriptor : public std::map<SlotID, CStackBasicDescriptor>
  18. {
  19. bool isDetailed;
  20. DLL_LINKAGE ArmyDescriptor(const CArmedInstance *army, bool detailed); //not detailed -> quantity ids as count
  21. DLL_LINKAGE ArmyDescriptor();
  22. DLL_LINKAGE int getStrength() const;
  23. };
  24. struct DLL_LINKAGE InfoAboutArmy
  25. {
  26. PlayerColor owner;
  27. std::string name;
  28. ArmyDescriptor army;
  29. InfoAboutArmy();
  30. InfoAboutArmy(const CArmedInstance *Army, bool detailed);
  31. void initFromArmy(const CArmedInstance *Army, bool detailed);
  32. };
  33. struct DLL_LINKAGE InfoAboutHero : public InfoAboutArmy
  34. {
  35. private:
  36. void assign(const InfoAboutHero & iah);
  37. public:
  38. struct DLL_LINKAGE Details
  39. {
  40. std::vector<si32> primskills;
  41. si32 mana, manaLimit, luck, morale;
  42. };
  43. std::optional<Details> details;
  44. const CHeroClass *hclass;
  45. HeroTypeID portraitSource;
  46. enum EInfoLevel
  47. {
  48. BASIC,
  49. DETAILED,
  50. INBATTLE
  51. };
  52. InfoAboutHero();
  53. InfoAboutHero(const InfoAboutHero & iah);
  54. InfoAboutHero(const CGHeroInstance *h, EInfoLevel infoLevel);
  55. InfoAboutHero & operator=(const InfoAboutHero & iah);
  56. void initFromHero(const CGHeroInstance *h, EInfoLevel infoLevel);
  57. int32_t getIconIndex() const;
  58. };
  59. /// Struct which holds a int information about a town
  60. struct DLL_LINKAGE InfoAboutTown : public InfoAboutArmy
  61. {
  62. struct DLL_LINKAGE Details
  63. {
  64. si32 hallLevel, goldIncome;
  65. bool customRes;
  66. bool garrisonedHero;
  67. };
  68. std::optional<Details> details;
  69. const CTown *tType;
  70. si32 built;
  71. si32 fortLevel; //0 - none
  72. InfoAboutTown();
  73. InfoAboutTown(const CGTownInstance *t, bool detailed);
  74. void initFromTown(const CGTownInstance *t, bool detailed);
  75. };
  76. VCMI_LIB_NAMESPACE_END