SaveResources.cpp 971 B

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