CArtifactsOfHeroMain.cpp 1.1 KB

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