1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-21 21:17:49 +02:00

Fixed warnings.

This commit is contained in:
AlexVinS 2019-01-08 00:40:09 +03:00
parent 9ec3d2ef64
commit f1cd4656ff
5 changed files with 24 additions and 26 deletions

View File

@ -122,7 +122,6 @@ TGoalVec Explore::getAllPossibleSubgoals()
} }
} }
auto primaryHero = ai->primaryHero().h;
for(auto h : heroes) for(auto h : heroes)
{ {
for(auto obj : objs) //double loop, performance risk? for(auto obj : objs) //double loop, performance risk?

View File

@ -44,9 +44,6 @@ TSubgoal GatherArmy::whatToDoToAchieve()
return fh->chooseSolution(getAllPossibleSubgoals()); //find dwelling. use current hero to prevent him from doing nothing. 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() TGoalVec GatherArmy::getAllPossibleSubgoals()
{ {
//get all possible towns, heroes and dwellings we may use //get all possible towns, heroes and dwellings we may use

View File

@ -193,7 +193,6 @@ bool AINodeStorage::isTileAccessible(int3 pos, const EPathfindingLayer layer) co
{ {
std::vector<AIPath> paths; std::vector<AIPath> paths;
auto chains = nodes[pos.x][pos.y][pos.z][layer]; auto chains = nodes[pos.x][pos.y][pos.z][layer];
auto initialPos = hero->visitablePos();
for(const AIPathNode & node : chains) for(const AIPathNode & node : chains)
{ {

View File

@ -232,7 +232,7 @@ namespace AIPathfinding
{ {
AIPathNode * boatNode = boatNodeOptional.get(); AIPathNode * boatNode = boatNodeOptional.get();
if(boatNode->action == CGPathNode::NOT_SET) if(boatNode->action == CGPathNode::UNKNOWN)
{ {
boatNode->specialAction = virtualBoat; boatNode->specialAction = virtualBoat;
destination.blocked = false; destination.blocked = false;

View File

@ -312,16 +312,19 @@ bool ResourceManager::removeOutdatedObjectives(std::function<bool(const Goals::T
{ //unfortunately we can't use remove_if on heap { //unfortunately we can't use remove_if on heap
auto it = boost::find_if(queue, [&](const ResourceObjective & ro) -> bool 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 if(it != queue.end()) //removed at least one
{ {
logAi->debug("Removing goal %s from ResourceManager.", it->goal->name()); logAi->debug("Removing goal %s from ResourceManager.", it->goal->name());
queue.erase(queue.s_handle_from_iterator(it)); queue.erase(queue.s_handle_from_iterator(it));
removedAnything = true; removedAnything = true;
} }
else //found nothing more to remove else
{ //found nothing more to remove
break; break;
}
} }
return removedAnything; return removedAnything;
} }