mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-21 21:17:49 +02:00
Fixed warnings.
This commit is contained in:
parent
9ec3d2ef64
commit
f1cd4656ff
@ -122,7 +122,6 @@ TGoalVec Explore::getAllPossibleSubgoals()
|
||||
}
|
||||
}
|
||||
|
||||
auto primaryHero = ai->primaryHero().h;
|
||||
for(auto h : heroes)
|
||||
{
|
||||
for(auto obj : objs) //double loop, performance risk?
|
||||
@ -199,9 +198,9 @@ bool Explore::hasReachableNeighbor(const int3 &pos, HeroPtr hero, CCallback * cb
|
||||
}
|
||||
|
||||
int Explore::howManyTilesWillBeDiscovered(
|
||||
const int3 & pos,
|
||||
int radious,
|
||||
CCallback * cbp,
|
||||
const int3 & pos,
|
||||
int radious,
|
||||
CCallback * cbp,
|
||||
const TeamState * ts,
|
||||
VCAI * aip,
|
||||
HeroPtr h) const
|
||||
@ -212,8 +211,8 @@ int Explore::howManyTilesWillBeDiscovered(
|
||||
for(int y = pos.y - radious; y <= pos.y + radious; y++)
|
||||
{
|
||||
int3 npos = int3(x, y, pos.z);
|
||||
if(cbp->isInTheMap(npos)
|
||||
&& pos.dist2d(npos) - 0.5 < radious
|
||||
if(cbp->isInTheMap(npos)
|
||||
&& pos.dist2d(npos) - 0.5 < radious
|
||||
&& !ts->fogOfWarMap[npos.x][npos.y][npos.z]
|
||||
&& hasReachableNeighbor(npos, h, cbp, aip))
|
||||
{
|
||||
@ -277,7 +276,7 @@ TSubgoal Explore::explorationNewPoint(HeroPtr h) const
|
||||
|
||||
int3 mapSize = cbp->getMapSize();
|
||||
int perimiter = 2 * radius * (mapSize.x + mapSize.y);
|
||||
|
||||
|
||||
std::vector<int3> from;
|
||||
std::vector<int3> to;
|
||||
|
||||
@ -420,4 +419,4 @@ void Explore::getVisibleNeighbours(const std::vector<int3> & tiles, std::vector<
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,9 +44,6 @@ TSubgoal GatherArmy::whatToDoToAchieve()
|
||||
return fh->chooseSolution(getAllPossibleSubgoals()); //find dwelling. use current hero to prevent him from doing nothing.
|
||||
}
|
||||
|
||||
static const BuildingID unitsSource[] = { BuildingID::DWELL_LVL_1, BuildingID::DWELL_LVL_2, BuildingID::DWELL_LVL_3,
|
||||
BuildingID::DWELL_LVL_4, BuildingID::DWELL_LVL_5, BuildingID::DWELL_LVL_6, BuildingID::DWELL_LVL_7};
|
||||
|
||||
TGoalVec GatherArmy::getAllPossibleSubgoals()
|
||||
{
|
||||
//get all possible towns, heroes and dwellings we may use
|
||||
|
@ -63,7 +63,7 @@ boost::optional<AIPathNode *> AINodeStorage::getOrCreateNode(const int3 & pos, c
|
||||
CGPathNode * AINodeStorage::getInitialNode()
|
||||
{
|
||||
auto hpos = hero->getPosition(false);
|
||||
auto initialNode =
|
||||
auto initialNode =
|
||||
getOrCreateNode(hpos, hero->boat ? EPathfindingLayer::SAIL : EPathfindingLayer::LAND, NORMAL_CHAIN)
|
||||
.get();
|
||||
|
||||
@ -99,7 +99,7 @@ void AINodeStorage::commit(CDestinationNodeInfo & destination, const PathNodeInf
|
||||
dstNode->action = destination.action;
|
||||
dstNode->theNodeBefore = srcNode->theNodeBefore;
|
||||
dstNode->manaCost = srcNode->manaCost;
|
||||
|
||||
|
||||
if(dstNode->specialAction)
|
||||
{
|
||||
dstNode->specialAction->applyOnDestination(getHero(), destination, source, dstNode, srcNode);
|
||||
@ -193,7 +193,6 @@ bool AINodeStorage::isTileAccessible(int3 pos, const EPathfindingLayer layer) co
|
||||
{
|
||||
std::vector<AIPath> paths;
|
||||
auto chains = nodes[pos.x][pos.y][pos.z][layer];
|
||||
auto initialPos = hero->visitablePos();
|
||||
|
||||
for(const AIPathNode & node : chains)
|
||||
{
|
||||
|
@ -77,9 +77,9 @@ namespace AIPathfinding
|
||||
bool isAffordableBy(HeroPtr hero, const AIPathNode * source) const
|
||||
{
|
||||
logAi->trace(
|
||||
"Hero %s has %d mana and needed %d and already spent %d",
|
||||
hero->name,
|
||||
hero->mana,
|
||||
"Hero %s has %d mana and needed %d and already spent %d",
|
||||
hero->name,
|
||||
hero->mana,
|
||||
getManaCost(hero),
|
||||
source->manaCost);
|
||||
|
||||
@ -215,7 +215,7 @@ namespace AIPathfinding
|
||||
}
|
||||
|
||||
bool tryEmbarkVirtualBoat(
|
||||
CDestinationNodeInfo &destination,
|
||||
CDestinationNodeInfo &destination,
|
||||
const PathNodeInfo &source,
|
||||
std::shared_ptr<const VirtualBoatAction> virtualBoat) const
|
||||
{
|
||||
@ -232,7 +232,7 @@ namespace AIPathfinding
|
||||
{
|
||||
AIPathNode * boatNode = boatNodeOptional.get();
|
||||
|
||||
if(boatNode->action == CGPathNode::NOT_SET)
|
||||
if(boatNode->action == CGPathNode::UNKNOWN)
|
||||
{
|
||||
boatNode->specialAction = virtualBoat;
|
||||
destination.blocked = false;
|
||||
|
@ -131,7 +131,7 @@ Goals::TSubgoal ResourceManager::collectResourcesForOurGoal(ResourceObjective &o
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (resourceType == Res::INVALID) //no needed resources has 0 income,
|
||||
if (resourceType == Res::INVALID) //no needed resources has 0 income,
|
||||
{
|
||||
//find the one which takes longest to collect
|
||||
typedef std::pair<Res::ERes, float> timePair;
|
||||
@ -160,7 +160,7 @@ Goals::TSubgoal ResourceManager::whatToDo() const //suggest any goal
|
||||
if (queue.size())
|
||||
{
|
||||
auto o = queue.top();
|
||||
|
||||
|
||||
auto allResources = cb->getResourceAmount(); //we don't consider savings, it's out top-priority goal
|
||||
if (allResources.canAfford(o.resources))
|
||||
return o.goal;
|
||||
@ -186,9 +186,9 @@ Goals::TSubgoal ResourceManager::whatToDo(TResources &res, Goals::TSubgoal goal)
|
||||
accumulatedResources += it->resources;
|
||||
|
||||
logAi->trace(
|
||||
"ResourceManager: checking goal %s, accumulatedResources=%s, available=%s",
|
||||
it->goal->name(),
|
||||
accumulatedResources.toString(),
|
||||
"ResourceManager: checking goal %s, accumulatedResources=%s, available=%s",
|
||||
it->goal->name(),
|
||||
accumulatedResources.toString(),
|
||||
allResources.toString());
|
||||
|
||||
if(!accumulatedResources.canBeAfforded(allResources))
|
||||
@ -312,16 +312,19 @@ bool ResourceManager::removeOutdatedObjectives(std::function<bool(const Goals::T
|
||||
{ //unfortunately we can't use remove_if on heap
|
||||
auto it = boost::find_if(queue, [&](const ResourceObjective & ro) -> bool
|
||||
{
|
||||
predicate(ro.goal);
|
||||
return predicate(ro.goal);
|
||||
});
|
||||
|
||||
if(it != queue.end()) //removed at least one
|
||||
{
|
||||
logAi->debug("Removing goal %s from ResourceManager.", it->goal->name());
|
||||
queue.erase(queue.s_handle_from_iterator(it));
|
||||
removedAnything = true;
|
||||
}
|
||||
else //found nothing more to remove
|
||||
else
|
||||
{ //found nothing more to remove
|
||||
break;
|
||||
}
|
||||
}
|
||||
return removedAnything;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user