AIhelper.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * AIhelper.h, 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 "AIhelper.h"
  12. #include "ResourceManager.h"
  13. boost::thread_specific_ptr<AIhelper> ah;
  14. AIhelper::AIhelper()
  15. {
  16. resourceManager.reset(new ResourceManager);
  17. }
  18. AIhelper::~AIhelper()
  19. {
  20. }
  21. bool AIhelper::notifyGoalCompleted(Goals::TSubgoal goal)
  22. {
  23. return resourceManager->notifyGoalCompleted(goal);
  24. }
  25. void AIhelper::setCB(CPlayerSpecificInfoCallback * CB)
  26. {
  27. resourceManager->setCB(CB);
  28. }
  29. void AIhelper::setAI(VCAI * AI)
  30. {
  31. resourceManager->setAI(AI);
  32. }
  33. Goals::TSubgoal AIhelper::whatToDo(TResources & res, Goals::TSubgoal goal)
  34. {
  35. return resourceManager->whatToDo(res, goal);
  36. }
  37. Goals::TSubgoal AIhelper::whatToDo() const
  38. {
  39. return resourceManager->whatToDo();
  40. }
  41. bool AIhelper::hasTasksLeft() const
  42. {
  43. return resourceManager->hasTasksLeft();
  44. }
  45. bool AIhelper::canAfford(const TResources & cost) const
  46. {
  47. return resourceManager->canAfford(cost);
  48. }
  49. TResources AIhelper::reservedResources() const
  50. {
  51. return resourceManager->reservedResources();
  52. }
  53. TResources AIhelper::freeResources() const
  54. {
  55. return resourceManager->freeResources();
  56. }
  57. TResource AIhelper::freeGold() const
  58. {
  59. return resourceManager->freeGold();
  60. }
  61. TResources AIhelper::allResources() const
  62. {
  63. return resourceManager->allResources();
  64. }
  65. TResource AIhelper::allGold() const
  66. {
  67. return resourceManager->allGold();
  68. }