SaveResources.cpp 869 B

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