Esempio n. 1
0
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();
    }
}
Esempio n. 2
0
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 );
    }
  }
}