CaptureObject.cpp 872 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. using namespace Goals;
  19. bool CaptureObject::operator==(const CaptureObject & other) const
  20. {
  21. return objid == other.objid;
  22. }
  23. uint64_t CaptureObject::getHash() const
  24. {
  25. return objid;
  26. }
  27. std::string CaptureObject::toString() const
  28. {
  29. return "Capture " + name + " at " + tile.toString();
  30. }
  31. TGoalVec CaptureObject::decompose() const
  32. {
  33. return CaptureObjectsBehavior(cb->getObj(ObjectInstanceID(objid))).decompose();
  34. }
  35. }