本文整理汇总了C++中PlayerCityPtr::isValid方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerCityPtr::isValid方法的具体用法?C++ PlayerCityPtr::isValid怎么用?C++ PlayerCityPtr::isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerCityPtr
的用法示例。
在下文中一共展示了PlayerCityPtr::isValid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _reachedWay
void PlayerArmy::_reachedWay()
{
if( _d->mode == PlayerArmy::go2location )
{
_attackAny();
return2fort();
}
else if( _d->mode == PlayerArmy::go2home )
{
PlayerCityPtr pCity = ptr_cast<PlayerCity>( _d->base );
if( pCity.isValid() )
{
for( auto sldr : _d->soldiersInfo )
{
int type = sldr.save[ "type" ];
WalkerPtr walker = WalkerManager::instance().create( (walker::Type)type, pCity );
walker->load( sldr.save );
walker->attach();
}
auto fort = pCity->getOverlay( _d->fortPos ).as<Fort>();
if( fort.isValid() )
{
fort->returnSoldiers();
fort->resetExpedition();
}
}
deleteLater();
}
}
示例2: _exec
void Notify::_exec(Game& game, unsigned int)
{
world::CityPtr pCity = game.empire()->findCity( _d->cityname );
PlayerCityPtr plrCity = ptr_cast<PlayerCity>( pCity );
if( plrCity.isValid() )
{
MilitaryPtr mil = plrCity->statistic().services.find<Military>();
if( mil.isValid() )
{
mil->addNotification( _d->message, _d->object, (Notification::Type)_d->type );
}
}
}