CaptureObject.cpp 922 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * CaptureObject.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 "CaptureObject.h"
  12. #include "../../../lib/mapObjects/CGTownInstance.h"
  13. #include "../AIGateway.h"
  14. #include "../Engine/Nullkiller.h"
  15. #include "../Behaviors/CaptureObjectsBehavior.h"
  16. namespace NKAI
  17. {
  18. extern boost::thread_specific_ptr<CCallback> cb;
  19. using namespace Goals;
  20. bool CaptureObject::operator==(const CaptureObject & other) const
  21. {
  22. return objid == other.objid;
  23. }
  24. uint64_t CaptureObject::getHash() const
  25. {
  26. return objid;
  27. }
  28. std::string CaptureObject::toString() const
  29. {
  30. return "Capture " + name + " at " + tile.toString();
  31. }
  32. TGoalVec CaptureObject::decompose() const
  33. {
  34. return CaptureObjectsBehavior(cb->getObj(ObjectInstanceID(objid))).decompose();
  35. }
  36. }