Exemplo 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();
    }
}
Exemplo n.º 2
0
bool LowBridge::canBuild(PlayerCityPtr city, TilePos pos, const TilesArray& ) const
{
  //bool is_constructible = Construction::canBuild( pos );

  TilePos endPos, startPos;
  _d->direction=noneDirection;

  TileOverlayPtr bridge = city->getOverlay( pos );
  if( bridge.isNull() )
  {
    _d->subtiles.clear();
    LowBridge* thisp = const_cast< LowBridge* >( this );
    thisp->_fgPicturesRef().clear();

    _checkParams( city, _d->direction, startPos, endPos, pos );

    if( _d->direction != noneDirection )
    {
      thisp->_computePictures( city, startPos, endPos, _d->direction );
    }
  }

  return (_d->direction != noneDirection);
}