CWindowWithArtifacts.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * CWindowWithArtifacts.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 "../widgets/CArtifactsOfHeroMain.h"
  12. #include "../widgets/CArtifactsOfHeroKingdom.h"
  13. #include "../widgets/CArtifactsOfHeroAltar.h"
  14. #include "../widgets/CArtifactsOfHeroMarket.h"
  15. #include "../widgets/CArtifactsOfHeroBackpack.h"
  16. #include "CWindowObject.h"
  17. class CWindowWithArtifacts : virtual public CWindowObject
  18. {
  19. public:
  20. using CArtifactsOfHeroPtr = std::shared_ptr<CArtifactsOfHeroBase>;
  21. std::vector<CArtifactsOfHeroPtr> artSets;
  22. explicit CWindowWithArtifacts(const std::vector<CArtifactsOfHeroPtr> * artSets = nullptr);
  23. void addSet(const std::shared_ptr<CArtifactsOfHeroBase> & newArtSet);
  24. const CGHeroInstance * getHeroPickedArtifact() const;
  25. const CArtifactInstance * getPickedArtifact() const;
  26. void clickPressedOnArtPlace(const CGHeroInstance * hero, const ArtifactPosition & slot,
  27. bool allowExchange, bool altarTrading, bool closeWindow);
  28. void swapArtifactAndClose(const CArtifactsOfHeroBase & artsInst, const ArtifactPosition & slot, const ArtifactLocation & dstLoc);
  29. void showArtifactAssembling(const CArtifactsOfHeroBase & artsInst, CArtPlace & artPlace, const Point & cursorPosition) const;
  30. void showArifactInfo(const CArtifactsOfHeroBase & artsInst, CArtPlace & artPlace, const Point & cursorPosition) const;
  31. void showQuickBackpackWindow(const CGHeroInstance * hero, const ArtifactPosition & slot, const Point & cursorPosition) const;
  32. void activate() override;
  33. void deactivate() override;
  34. void enableKeyboardShortcuts() const;
  35. virtual void update();
  36. protected:
  37. void markPossibleSlots() const;
  38. bool checkSpecialArts(const CArtifactInstance & artInst, const CGHeroInstance & hero, bool isTrade) const;
  39. void setCursorAnimation(const CArtifactInstance & artInst) const;
  40. void putPickedArtifact(const CGHeroInstance & curHero, const ArtifactPosition & targetSlot) const;
  41. void onClickPressedCommonArtifact(const CGHeroInstance & curHero, const ArtifactPosition & slot, bool closeWindow);
  42. };