1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-16 10:19:47 +02:00
vcmi/AI/VCAI/AIhelper.cpp

145 lines
3.1 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
*
*/
#include "StdInc.h"
#include "AIhelper.h"
#include "ResourceManager.h"
2018-07-29 18:27:21 +02:00
#include "BuildingManager.h"
2018-07-26 12:06:55 +02:00
AIhelper::AIhelper()
{
2018-07-27 09:22:07 +02:00
resourceManager.reset(new ResourceManager());
2018-07-29 18:27:21 +02:00
buildingManager.reset(new BuildingManager());
pathfindingManager.reset(new PathfindingManager());
2018-07-26 12:06:55 +02:00
}
AIhelper::~AIhelper()
{
}
bool AIhelper::notifyGoalCompleted(Goals::TSubgoal goal)
{
return resourceManager->notifyGoalCompleted(goal);
}
void AIhelper::setCB(CPlayerSpecificInfoCallback * CB)
{
resourceManager->setCB(CB);
2018-07-29 18:27:21 +02:00
buildingManager->setCB(CB);
pathfindingManager->setCB(CB);
2018-07-26 12:06:55 +02:00
}
void AIhelper::setAI(VCAI * AI)
{
resourceManager->setAI(AI);
2018-07-29 18:27:21 +02:00
buildingManager->setAI(AI);
pathfindingManager->setAI(AI);
2018-07-29 18:27:21 +02:00
}
bool AIhelper::getBuildingOptions(const CGTownInstance * t)
{
return buildingManager->getBuildingOptions(t);
}
boost::optional<PotentialBuilding> AIhelper::immediateBuilding() const
{
return buildingManager->immediateBuilding();
}
boost::optional<PotentialBuilding> AIhelper::expensiveBuilding() const
{
return buildingManager->expensiveBuilding();
}
boost::optional<BuildingID> AIhelper::canBuildAnyStructure(const CGTownInstance * t, const std::vector<BuildingID> & buildList, unsigned int maxDays) const
{
return buildingManager->canBuildAnyStructure(t, buildList, maxDays);
2018-07-26 12:06:55 +02:00
}
Goals::TSubgoal AIhelper::whatToDo(TResources & res, Goals::TSubgoal goal)
{
return resourceManager->whatToDo(res, goal);
}
Goals::TSubgoal AIhelper::whatToDo() const
{
return resourceManager->whatToDo();
}
bool AIhelper::containsObjective(Goals::TSubgoal goal) const
{
return resourceManager->containsObjective(goal);
}
2018-07-26 12:06:55 +02:00
bool AIhelper::hasTasksLeft() const
{
return resourceManager->hasTasksLeft();
}
bool AIhelper::canAfford(const TResources & cost) const
{
return resourceManager->canAfford(cost);
}
TResources AIhelper::reservedResources() const
{
return resourceManager->reservedResources();
}
TResources AIhelper::freeResources() const
{
return resourceManager->freeResources();
}
TResource AIhelper::freeGold() const
{
return resourceManager->freeGold();
}
TResources AIhelper::allResources() const
{
return resourceManager->allResources();
}
TResource AIhelper::allGold() const
{
return resourceManager->allGold();
}
Goals::TGoalVec AIhelper::howToVisitTile(int3 tile)
{
return pathfindingManager->howToVisitTile(tile);
}
Goals::TGoalVec AIhelper::howToVisitObj(ObjectIdRef obj)
{
return pathfindingManager->howToVisitObj(obj);
}
Goals::TGoalVec AIhelper::howToVisitTile(HeroPtr hero, int3 tile, bool allowGatherArmy)
{
return pathfindingManager->howToVisitTile(hero, tile, allowGatherArmy);
}
Goals::TGoalVec AIhelper::howToVisitObj(HeroPtr hero, ObjectIdRef obj, bool allowGatherArmy)
{
return pathfindingManager->howToVisitObj(hero, obj, allowGatherArmy);
}
std::vector<AIPath> AIhelper::getPathsToTile(HeroPtr hero, int3 tile)
{
return pathfindingManager->getPathsToTile(hero, tile);
}
void AIhelper::resetPaths()
{
pathfindingManager->resetPaths();
}