CArtifactsOfHeroMain.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * CArtifactsOfHeroMain.cpp, 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. #include "StdInc.h"
  11. #include "CArtifactsOfHeroMain.h"
  12. #include "../CPlayerInterface.h"
  13. #include "../../CCallback.h"
  14. CArtifactsOfHeroMain::CArtifactsOfHeroMain(const Point & position)
  15. {
  16. init(
  17. std::bind(&CArtifactsOfHeroBase::leftClickArtPlace, this, _1),
  18. std::bind(&CArtifactsOfHeroBase::rightClickArtPlace, this, _1),
  19. position,
  20. std::bind(&CArtifactsOfHeroBase::scrollBackpack, this, _1));
  21. }
  22. CArtifactsOfHeroMain::~CArtifactsOfHeroMain()
  23. {
  24. putBackPickedArtifact();
  25. }
  26. void CArtifactsOfHeroMain::swapArtifacts(const ArtifactLocation & srcLoc, const ArtifactLocation & dstLoc)
  27. {
  28. LOCPLINT->cb->swapArtifacts(srcLoc, dstLoc);
  29. }
  30. void CArtifactsOfHeroMain::pickUpArtifact(CHeroArtPlace & artPlace)
  31. {
  32. LOCPLINT->cb->swapArtifacts(ArtifactLocation(curHero, artPlace.slot),
  33. ArtifactLocation(curHero, ArtifactPosition::TRANSITION_POS));
  34. }