本文整理汇总了C++中Propagator::getPath方法的典型用法代码示例。如果您正苦于以下问题:C++ Propagator::getPath方法的具体用法?C++ Propagator::getPath怎么用?C++ Propagator::getPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Propagator
的用法示例。
在下文中一共展示了Propagator::getPath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computeWalkerPath
void TraineeWalker::computeWalkerPath()
{
_maxNeed = 0; // need of this trainee in buildings
Propagator pathPropagator;
pathPropagator.init( *_originBuilding.object() );
pathPropagator.propagate(_maxDistance);
for (std::list<BuildingType>::iterator itType = _buildingNeed.begin(); itType != _buildingNeed.end(); ++itType)
{
BuildingType buildingType = *itType;
checkDestination(buildingType, pathPropagator);
}
if( _destinationBuilding != NULL )
{
// some building needs that trainee!
// std::cout << "trainee sent!" << std::endl;
PathWay pathWay;
pathPropagator.getPath( _destinationBuilding, pathWay);
setPathWay( pathWay );
setIJ( _pathWay.getOrigin().getIJ() );
}
else
{
// nobody needs him...
// std::cout << "trainee suicide!" << std::endl;
deleteLater();
}
}
示例2: computeWalkerPath
void TraineeWalker::computeWalkerPath()
{
_maxNeed = 0; // need of this trainee in buildings
Propagator pathPropagator;
pathPropagator.init(*_originBuilding);
pathPropagator.propagate(_maxDistance);
for (std::list<BuildingType>::iterator itType = _buildingNeed.begin(); itType != _buildingNeed.end(); ++itType)
{
BuildingType buildingType = *itType;
checkDestination(buildingType, pathPropagator);
}
if (_destinationBuilding != NULL)
{
// some building needs that trainee!
// std::cout << "trainee sent!" << std::endl;
PathWay pathWay;
pathPropagator.getPath(*_destinationBuilding, pathWay);
setPathWay(pathWay);
setIJ(_pathWay.getOrigin().getI(), _pathWay.getOrigin().getJ());
Scenario::instance().getCity().getWalkerList().push_back(this);
_destinationBuilding->reserveTrainee(_traineeType);
}
else
{
// nobody needs him...
// std::cout << "trainee suicide!" << std::endl;
_isDeleted = true;
}
}
示例3: assignPath
void Emigrant::assignPath( const Road& startPoint )
{
std::list<PathWay> pathWayList;
std::list<LandOverlay*> houses = Scenario::instance().getCity().getBuildingList(B_HOUSE);
House* blankHouse = 0;
for( std::list<LandOverlay*>::iterator itHouse = houses.begin(); itHouse != houses.end(); ++itHouse )
{
if( House* house = dynamic_cast<House*>(*itHouse) )
{
if( house->getNbHabitants() < house->getMaxHabitants() )
{
blankHouse = house;
_d->destination = house->getTile().getIJ();
break;
}
}
}
Propagator pathfinder;
PathWay pathWay;
pathfinder.init( const_cast< Road& >( startPoint ) );
bool findPath = pathfinder.getPath( *blankHouse, pathWay );
if( findPath )
{
setPathWay( pathWay );
setIJ(_pathWay.getOrigin().getI(), _pathWay.getOrigin().getJ());
}
}
示例4: assignPath
void Immigrant::assignPath( const Building& home )
{
City& city = Scenario::instance().getCity();
Tile& exitTile = city.getTilemap().at( city.getRoadExitI(), city.getRoadExitJ() );
Road* exitRoad = dynamic_cast< Road* >( exitTile.get_terrain().getOverlay() );
if( exitRoad )
{
Propagator pathfinder;
PathWay pathWay;
pathfinder.init( const_cast< Building& >( home ) );
bool findPath = pathfinder.getPath( *exitRoad, pathWay );
if( findPath )
{
setPathWay( pathWay );
setIJ(_pathWay.getOrigin().getI(), _pathWay.getOrigin().getJ());
}
}
else
_isDeleted = true;
}