AIhelper.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. #pragma once
  11. /*
  12. !!! Note: Include THIS file at the end of include list to avoid "undefined base class" error
  13. */
  14. #include "ResourceManager.h"
  15. class ResourceManager;
  16. //indirection interface for various modules
  17. class DLL_EXPORT AIhelper : public IResourceManager
  18. {
  19. friend class VCAI;
  20. friend struct SetGlobalState; //mess?
  21. //members are thread_specific. AIhelper is global
  22. std::shared_ptr<ResourceManager> resourceManager;
  23. std::shared_ptr<VCAI> ai;
  24. public:
  25. AIhelper();
  26. ~AIhelper();
  27. //TODO: consider common interface with Resource Manager?
  28. bool canAfford(const TResources & cost) const;
  29. TResources reservedResources() const override;
  30. TResources freeResources() const override;
  31. TResource freeGold() const override;
  32. TResources allResources() const override;
  33. TResource allGold() const override;
  34. Goals::TSubgoal whatToDo(TResources &res, Goals::TSubgoal goal) override;
  35. Goals::TSubgoal whatToDo() const override; //peek highest-priority goal
  36. bool hasTasksLeft() const override;
  37. private:
  38. bool notifyGoalCompleted(Goals::TSubgoal goal);
  39. void setCB(CPlayerSpecificInfoCallback * CB) override;
  40. void setAI(VCAI * AI) override;
  41. };