CArtifactsOfHeroMain.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 "../../lib/mapObjects/CGHeroInstance.h"
  14. #include "../../CCallback.h"
  15. #include "../../lib/networkPacks/ArtifactLocation.h"
  16. CArtifactsOfHeroMain::CArtifactsOfHeroMain(const Point & position)
  17. {
  18. init(
  19. std::bind(&CArtifactsOfHeroBase::clickPrassedArtPlace, this, _1, _2),
  20. std::bind(&CArtifactsOfHeroBase::showPopupArtPlace, this, _1, _2),
  21. position,
  22. std::bind(&CArtifactsOfHeroBase::scrollBackpack, this, _1));
  23. addGestureCallback(std::bind(&CArtifactsOfHeroBase::gestureArtPlace, this, _1, _2));
  24. }
  25. CArtifactsOfHeroMain::~CArtifactsOfHeroMain()
  26. {
  27. putBackPickedArtifact();
  28. }
  29. void CArtifactsOfHeroMain::swapArtifacts(const ArtifactLocation & srcLoc, const ArtifactLocation & dstLoc)
  30. {
  31. LOCPLINT->cb->swapArtifacts(srcLoc, dstLoc);
  32. }
  33. void CArtifactsOfHeroMain::pickUpArtifact(CArtPlace & artPlace)
  34. {
  35. LOCPLINT->cb->swapArtifacts(ArtifactLocation(curHero->id, artPlace.slot),
  36. ArtifactLocation(curHero->id, ArtifactPosition::TRANSITION_POS));
  37. }