示例#1
0
void TraineeWalker::_checkDestination(const object::Type buildingType, Propagator &pathPropagator)
{
  DirectPRoutes pathWayList = pathPropagator.getRoutes( buildingType );

  for( auto item : pathWayList )
  {
    // for every building within range
    BuildingPtr building = item.first.as<Building>();

    float need = building->evaluateTrainee( type() );
    if (need > _d->maxNeed)
    {
      _d->maxNeed = need;
      _d->destLocation = building->pos();
    }
  }
}
示例#2
0
void TraineeWalker::checkDestination(const BuildingType buildingType, Propagator &pathPropagator)
{
  Propagator::ReachedBuldings pathWayList;
  pathPropagator.getReachedBuildings(buildingType, pathWayList);

  for( Propagator::ReachedBuldings::iterator pathWayIt= pathWayList.begin(); 
    pathWayIt != pathWayList.end(); ++pathWayIt)
  {
    // for every building within range
    BuildingPtr building = pathWayIt->first;

    float need = building->evaluateTrainee(_traineeType);
    if (need > _maxNeed)
    {
      _maxNeed = need;
      _destinationBuilding = building;
    }
  }
}