mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-08 23:36:33 +02:00
formatting
This commit is contained in:
parent
6abebeeb9f
commit
a8696a9957
@ -503,10 +503,10 @@ ui64 howManyReinforcementsCanBuy(HeroPtr h, const CGTownInstance * t)
|
|||||||
ui64 aivalue = 0;
|
ui64 aivalue = 0;
|
||||||
|
|
||||||
int freeHeroSlots = GameConstants::ARMY_SIZE - h->stacksCount();
|
int freeHeroSlots = GameConstants::ARMY_SIZE - h->stacksCount();
|
||||||
for (auto const dc : t->creatures)
|
for(auto const dc : t->creatures)
|
||||||
{
|
{
|
||||||
creInfo ci = infoFromDC(dc);
|
creInfo ci = infoFromDC(dc);
|
||||||
if (ci.count && ci.creID != -1) //valid creature at this level
|
if(ci.count && ci.creID != -1) //valid creature at this level
|
||||||
{
|
{
|
||||||
//can be merged with another stack?
|
//can be merged with another stack?
|
||||||
SlotID dst = h->getSlotFor(ci.creID);
|
SlotID dst = h->getSlotFor(ci.creID);
|
||||||
|
@ -16,7 +16,7 @@ boost::thread_specific_ptr<AIhelper> ah;
|
|||||||
|
|
||||||
AIhelper::AIhelper()
|
AIhelper::AIhelper()
|
||||||
{
|
{
|
||||||
resourceManager.reset(new ResourceManager);
|
resourceManager.reset(new ResourceManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
AIhelper::~AIhelper()
|
AIhelper::~AIhelper()
|
||||||
|
@ -220,7 +220,7 @@ namespace Goals
|
|||||||
}
|
}
|
||||||
std::string BuyArmy::completeMessage() const
|
std::string BuyArmy::completeMessage() const
|
||||||
{
|
{
|
||||||
return boost::format("Bought army of value %d in town of %s") % boost::lexical_cast<std::string>(value), town->name;
|
return boost::format("Bought army of value %d in town of %s") % value, town->name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -537,8 +537,10 @@ TSubgoal ClearWayTo::whatToDoToAchieve()
|
|||||||
bool Goals::ClearWayTo::fulfillsMe(TSubgoal goal)
|
bool Goals::ClearWayTo::fulfillsMe(TSubgoal goal)
|
||||||
{
|
{
|
||||||
if (goal->goalType == Goals::VISIT_TILE)
|
if (goal->goalType == Goals::VISIT_TILE)
|
||||||
|
{
|
||||||
if (!hero || hero == goal->hero)
|
if (!hero || hero == goal->hero)
|
||||||
return tile == goal->tile;
|
return tile == goal->tile;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -987,9 +989,7 @@ TGoalVec Goals::CollectRes::getAllPossibleSubgoals()
|
|||||||
if (dest != t) //there is something blocking our way
|
if (dest != t) //there is something blocking our way
|
||||||
ret.push_back(sptr(Goals::ClearWayTo(dest, h).setisAbstract(true)));
|
ret.push_back(sptr(Goals::ClearWayTo(dest, h).setisAbstract(true)));
|
||||||
else
|
else
|
||||||
{
|
|
||||||
ret.push_back(sptr(Goals::VisitTile(dest).sethero(h).setisAbstract(true)));
|
ret.push_back(sptr(Goals::VisitTile(dest).sethero(h).setisAbstract(true)));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else //we need to get army in order to pick that object
|
else //we need to get army in order to pick that object
|
||||||
ret.push_back(sptr(Goals::GatherArmy(evaluateDanger(dest, h) * SAFE_ATTACK_CONSTANT).sethero(h).setisAbstract(true)));
|
ret.push_back(sptr(Goals::GatherArmy(evaluateDanger(dest, h) * SAFE_ATTACK_CONSTANT).sethero(h).setisAbstract(true)));
|
||||||
|
@ -80,12 +80,12 @@ public:
|
|||||||
TResource allGold() const override;
|
TResource allGold() const override;
|
||||||
|
|
||||||
Goals::TSubgoal whatToDo() const override; //peek highest-priority goal
|
Goals::TSubgoal whatToDo() const override; //peek highest-priority goal
|
||||||
Goals::TSubgoal whatToDo(TResources &res, Goals::TSubgoal goal); //can we afford this goal or need to CollectRes?
|
Goals::TSubgoal whatToDo(TResources & res, Goals::TSubgoal goal); //can we afford this goal or need to CollectRes?
|
||||||
bool containsObjective(Goals::TSubgoal goal) const;
|
bool containsObjective(Goals::TSubgoal goal) const;
|
||||||
bool hasTasksLeft() const override;
|
bool hasTasksLeft() const override;
|
||||||
|
|
||||||
protected: //not-const actions only for AI
|
protected: //not-const actions only for AI
|
||||||
virtual void reserveResoures(TResources &res, Goals::TSubgoal goal = Goals::TSubgoal());
|
virtual void reserveResoures(TResources & res, Goals::TSubgoal goal = Goals::TSubgoal());
|
||||||
virtual bool notifyGoalCompleted(Goals::TSubgoal goal);
|
virtual bool notifyGoalCompleted(Goals::TSubgoal goal);
|
||||||
virtual bool updateGoal(Goals::TSubgoal goal); //new goal must have same properties but different priority
|
virtual bool updateGoal(Goals::TSubgoal goal); //new goal must have same properties but different priority
|
||||||
virtual bool tryPush(const ResourceObjective &o);
|
virtual bool tryPush(const ResourceObjective &o);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user