CArtifactsOfHeroMain.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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::leftClickArtPlace, this, _1),
  20. std::bind(&CArtifactsOfHeroBase::rightClickArtPlace, this, _1),
  21. position,
  22. std::bind(&CArtifactsOfHeroBase::scrollBackpack, this, _1));
  23. }
  24. CArtifactsOfHeroMain::~CArtifactsOfHeroMain()
  25. {
  26. putBackPickedArtifact();
  27. }
  28. void CArtifactsOfHeroMain::swapArtifacts(const ArtifactLocation & srcLoc, const ArtifactLocation & dstLoc)
  29. {
  30. LOCPLINT->cb->swapArtifacts(srcLoc, dstLoc);
  31. }
  32. void CArtifactsOfHeroMain::pickUpArtifact(CHeroArtPlace & artPlace)
  33. {
  34. LOCPLINT->cb->swapArtifacts(ArtifactLocation(curHero->id, artPlace.slot),
  35. ArtifactLocation(curHero->id, ArtifactPosition::TRANSITION_POS));
  36. }