AIhelper.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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::containsObjective(Goals::TSubgoal goal) const
  42. {
  43. return resourceManager->containsObjective(goal);
  44. }
  45. bool AIhelper::hasTasksLeft() const
  46. {
  47. return resourceManager->hasTasksLeft();
  48. }
  49. bool AIhelper::canAfford(const TResources & cost) const
  50. {
  51. return resourceManager->canAfford(cost);
  52. }
  53. TResources AIhelper::reservedResources() const
  54. {
  55. return resourceManager->reservedResources();
  56. }
  57. TResources AIhelper::freeResources() const
  58. {
  59. return resourceManager->freeResources();
  60. }
  61. TResource AIhelper::freeGold() const
  62. {
  63. return resourceManager->freeGold();
  64. }
  65. TResources AIhelper::allResources() const
  66. {
  67. return resourceManager->allResources();
  68. }
  69. TResource AIhelper::allGold() const
  70. {
  71. return resourceManager->allGold();
  72. }