mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-17 01:32:21 +02:00
Should fix #2624.
This commit is contained in:
@ -926,13 +926,17 @@ TSubgoal GatherTroops::whatToDoToAchieve()
|
|||||||
{
|
{
|
||||||
nearestDwellings[hero] = *boost::range::min_element(dwellings, CDistanceSorter(hero));
|
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
|
return sptr(Goals::GetObj(nearest->id.getNum()));
|
||||||
const CGDwelling * nearest = boost::range::min_element(nearestDwellings, comparator)->second;
|
}
|
||||||
if(nearest) // FIXME: Find out what regression / bug cause this. Issue 2624
|
else
|
||||||
throw cannotFulfillGoalException("Cannot find nearest dwelling!");
|
return sptr(Goals::Explore());
|
||||||
|
|
||||||
return sptr (Goals::GetObj(nearest->id.getNum()));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return sptr (Goals::Explore());
|
return sptr (Goals::Explore());
|
||||||
|
Reference in New Issue
Block a user