1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-05 15:05:40 +02:00
vcmi/AI/VCAI/AIhelper.h

71 lines
2.3 KiB
C
Raw Normal View History

2018-07-26 12:06:55 +02:00
/*
* AIhelper.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#pragma once
/*
!!! Note: Include THIS file at the end of include list to avoid "undefined base class" error
*/
#include "ResourceManager.h"
2018-07-29 18:27:21 +02:00
#include "BuildingManager.h"
#include "Pathfinding/PathfindingManager.h"
2018-07-26 12:06:55 +02:00
class ResourceManager;
2018-07-29 18:27:21 +02:00
class BuildingManager;
2018-07-26 12:06:55 +02:00
//indirection interface for various modules
class DLL_EXPORT AIhelper : public IResourceManager, public IBuildingManager, public IPathfindingManager
2018-07-26 12:06:55 +02:00
{
friend class VCAI;
friend struct SetGlobalState; //mess?
std::shared_ptr<ResourceManager> resourceManager;
2018-07-29 18:27:21 +02:00
std::shared_ptr<BuildingManager> buildingManager;
std::shared_ptr<PathfindingManager> pathfindingManager;
2018-07-29 18:27:21 +02:00
//TODO: vector<IAbstractManager>
2018-07-26 12:06:55 +02:00
public:
AIhelper();
~AIhelper();
bool canAfford(const TResources & cost) const;
TResources reservedResources() const override;
TResources freeResources() const override;
TResource freeGold() const override;
TResources allResources() const override;
TResource allGold() const override;
Goals::TSubgoal whatToDo(TResources &res, Goals::TSubgoal goal) override;
Goals::TSubgoal whatToDo() const override;
bool containsObjective(Goals::TSubgoal goal) const;
2018-07-26 12:06:55 +02:00
bool hasTasksLeft() const override;
bool getBuildingOptions(const CGTownInstance * t) override;
BuildingID getMaxPossibleGoldBuilding(const CGTownInstance * t);
boost::optional<PotentialBuilding> immediateBuilding() const override;
boost::optional<PotentialBuilding> expensiveBuilding() const override;
boost::optional<BuildingID> canBuildAnyStructure(const CGTownInstance * t, const std::vector<BuildingID> & buildList, unsigned int maxDays = 7) const override;
Goals::TGoalVec howToVisitTile(HeroPtr hero, int3 tile, bool allowGatherArmy = true) override;
Goals::TGoalVec howToVisitObj(HeroPtr hero, ObjectIdRef obj, bool allowGatherArmy = true) override;
Goals::TGoalVec howToVisitTile(int3 tile) override;
Goals::TGoalVec howToVisitObj(ObjectIdRef obj) override;
std::vector<AIPath> getPathsToTile(HeroPtr hero, int3 tile) override;
void resetPaths() override;
2018-07-26 12:06:55 +02:00
private:
bool notifyGoalCompleted(Goals::TSubgoal goal);
2018-10-09 22:31:44 +03:00
void init(CPlayerSpecificInfoCallback * CB) override;
2018-07-26 12:06:55 +02:00
void setAI(VCAI * AI) override;
};