Skip to content

Commit

Permalink
Should fix #2624.
Browse files Browse the repository at this point in the history
  • Loading branch information
DjWarmonger authored and DjWarmonger committed Nov 29, 2016
1 parent fd3992d commit eaf14f6
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions AI/VCAI/Goals.cpp
Expand Up @@ -926,13 +926,17 @@ TSubgoal GatherTroops::whatToDoToAchieve()
{
nearestDwellings[hero] = *boost::range::min_element(dwellings, CDistanceSorter(hero));
}
if (nearestDwellings.size())
{
// find hero who is nearest to a dwelling
const CGDwelling * nearest = boost::range::min_element(nearestDwellings, comparator)->second;
if (!nearest)
throw cannotFulfillGoalException("Cannot find nearest dwelling!");

// find hero who is nearest to a dwelling
const CGDwelling * nearest = boost::range::min_element(nearestDwellings, comparator)->second;
if(nearest) // FIXME: Find out what regression / bug cause this. Issue 2624
throw cannotFulfillGoalException("Cannot find nearest dwelling!");

return sptr (Goals::GetObj(nearest->id.getNum()));
return sptr(Goals::GetObj(nearest->id.getNum()));
}
else
return sptr(Goals::Explore());
}
else
return sptr (Goals::Explore());
Expand Down

0 comments on commit eaf14f6

Please sign in to comment.