本文整理汇总了C++中PlayerCityPtr::addOverlay方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerCityPtr::addOverlay方法的具体用法?C++ PlayerCityPtr::addOverlay怎么用?C++ PlayerCityPtr::addOverlay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerCityPtr
的用法示例。
在下文中一共展示了PlayerCityPtr::addOverlay方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: decodeTerrain
void LoaderHelper::decodeTerrain( Tile &oTile, PlayerCityPtr city, unsigned int forceId )
{
int changeId = 0;
unsigned int imgId = oTile.originalImgId();
object::Type ovType = object::unknown;
if( oTile.getFlag( Tile::tlRoad ) ) // road
{
ovType = object::road;
Picture pic = MetaDataHolder::randomPicture( object::terrain, Size(1) );
oTile.setPicture( pic );
changeId = imgid::fromResource( pic.name() );
}
else if( oTile.getFlag( Tile::tlTree ) )
{
ovType = object::tree;
Picture pic = MetaDataHolder::randomPicture( object::terrain, Size(1) );
oTile.setPicture( pic );
changeId = imgid::fromResource( pic.name() );
}
else if( oTile.getFlag( Tile::tlMeadow ) )
{
/*bool oldgfx = !SETTINGS_VALUE( c3gfx ).toString().empty();
oldgfx |= SETTINGS_VALUE( oldgfx ).toBool();
if( !oldgfx )
{
Picture pic = MetaDataHolder::randomPicture( objects::meadow, Size(1) );
oTile.setPicture( pic );
changeId = imgid::fromResource( pic.name() );
}*/
}
else if( imgId >= 0x29c && imgId <= 0x2a1 ) //aqueduct
{
ovType = object::aqueduct;
Picture pic = MetaDataHolder::randomPicture( object::terrain, Size(1) );
oTile.setPicture( pic );
oTile.setFlag( Tile::clearAll, true );
changeId = imgid::fromResource( pic.name() );
}
else if( imgId >= 372 && imgId <= 427 )
{
oTile.setFlag( Tile::tlCoast, true );
if( imgId >= 388 )
oTile.setFlag( Tile::tlRubble, true );
}
else if( imgId >= 863 && imgId <= 870 )
{
Picture pic = MetaDataHolder::randomPicture( object::terrain, Size(1) );
oTile.setPicture( pic );
oTile.setFlag( Tile::clearAll, true );
changeId = imgid::fromResource( pic.name() );
oTile.setOriginalImgId( changeId );
}
else
{
unsigned id = forceId > 0 ? forceId : oTile.originalImgId();
ovType = convImgId2ovrType( id );
}
if( ovType == object::unknown )
return;
OverlayPtr overlay; // This is the overlay object, if any
overlay = TileOverlayFactory::instance().create( ovType );
if( ovType == object::elevation )
{
std::string elevationPicName = imgid::toResource( oTile.originalImgId() );
overlay->setPicture( Picture( elevationPicName ) );
}
if( overlay != NULL )
{
//Logger::warning( "Building at ( %d, %d ) with ID: %x", oTile.i(), oTile.j(), oTile.originalImgId() );
if( oTile.overlay().isValid() )
return;
city::AreaInfo info( city, oTile.pos() );
overlay->build( info );
city->addOverlay( overlay );
}
if( changeId > 0 )
{
oTile.setOriginalImgId( changeId );
}
}