本文整理汇总了C++中Road::computePicture方法的典型用法代码示例。如果您正苦于以下问题:C++ Road::computePicture方法的具体用法?C++ Road::computePicture怎么用?C++ Road::computePicture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Road
的用法示例。
在下文中一共展示了Road::computePicture方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: build
void Road::build(const TilePos& pos )
{
Tilemap& tilemap = Scenario::instance().getCity().getTilemap();
LandOverlay* saveOverlay = tilemap.at( pos ).get_terrain().getOverlay();
Construction::build( pos );
setPicture(computePicture());
if( Aqueduct* aqua = safety_cast< Aqueduct* >( saveOverlay ) )
{
aqua->build( pos );
return;
}
// update adjacent roads
for (std::list<Tile*>::iterator itTile = _accessRoads.begin(); itTile != _accessRoads.end(); ++itTile)
{
Road* road = safety_cast< Road* >( (*itTile)->get_terrain().getOverlay() ); // let's think: may here different type screw up whole program?
if( road )
{
road->computeAccessRoads();
road->setPicture(road->computePicture());
}
}
// NOTE: also we need to update accessRoads for adjacent building
// how to detect them if MaxDistance2Road can be any
// so let's recompute accessRoads for every _building_
std::list<LandOverlay*> list = Scenario::instance().getCity().getOverlayList(); // it looks terrible!!!!
for (std::list<LandOverlay*>::iterator itOverlay = list.begin(); itOverlay!=list.end(); ++itOverlay)
{
LandOverlay *overlay = *itOverlay;
Building *construction = dynamic_cast<Building*>(overlay);
if (construction != NULL) // if NULL then it ISN'T building
{
construction->computeAccessRoads();
}
}
}