SaveResources.cpp 907 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * SaveResources.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 "SaveResources.h"
  12. #include "../AIGateway.h"
  13. #include "../../../lib/CPathfinder.h"
  14. #include "../Behaviors/CaptureObjectsBehavior.h"
  15. namespace NKAI
  16. {
  17. extern boost::thread_specific_ptr<CCallback> cb;
  18. extern boost::thread_specific_ptr<AIGateway> ai;
  19. using namespace Goals;
  20. bool SaveResources::operator==(const SaveResources & other) const
  21. {
  22. return true;
  23. }
  24. void SaveResources::accept(AIGateway * ai)
  25. {
  26. ai->nullkiller->lockResources(resources);
  27. logAi->debug("Locked %s resources", resources.toString());
  28. throw goalFulfilledException(sptr(*this));
  29. }
  30. std::string SaveResources::toString() const
  31. {
  32. return "SaveResources " + resources.toString();
  33. }
  34. }