Exemplo n.º 1
0
  SmartList<Dst> select() const
  {
    SmartList<Dst> ret;
    for( auto it : *this )
      ret.addIfValid( ptr_cast<Dst>( it ) );

    return ret;
  }
Exemplo n.º 2
0
  SmartList<Dst> select() const
  {
    SmartList<Dst> ret;
    for( const auto& it : _data )
      ret.addIfValid(ptr_cast<Dst>(it));

    return ret;
  }
Exemplo n.º 3
0
inline SmartList< T > Statistic::_Objects::find( object::Type type ) const
{
  SmartList< T > ret;
  auto buildings = _parent.rcity.overlays();
  for( auto bld : buildings )
  {
    if( bld.isValid() && (bld->type() == type || type == object::any) )
      ret.addIfValid( bld.as<T>() );
  }

  return ret;
}
Exemplo n.º 4
0
inline SmartList< T > Statistic::_Objects::find( object::TypeSet types ) const
{
  SmartList< T > ret;
  auto buildings = _parent.rcity.overlays();
  for( auto bld : buildings )
  {
    if( bld.isValid() && types.count( bld->type() ) > 0 )
      ret.addIfValid( bld.as<T>() );
  }

  return ret;
}
Exemplo n.º 5
0
inline SmartList< T > Statistic::_Objects::findNotIn( const std::set<object::Group>& which ) const
{
  SmartList< T > ret;
  auto& overlays = _parent.rcity.overlays();

  for( auto ov : overlays )
  {
    if( which.count( ov->group() ) == 0 )
    {
      ret.addIfValid( ov.as<T>() );
    }
  }

  return ret;
}
Exemplo n.º 6
0
inline SmartList<T> Statistic::_Walkers::find( walker::Type type,
                                               TilePos start, TilePos stop ) const
{
  WalkerList walkersInArea;

  TilePos stopPos = stop;

  if( start == gfx::tilemap::invalidLocation() )
  {
    const WalkerList& all =_parent.rcity.walkers();
    walkersInArea.insert( walkersInArea.end(), all.begin(), all.end() );
  }
  else if( stopPos == gfx::tilemap::invalidLocation() )
  {
    const WalkerList& wlkOnTile = _parent.rcity.walkers( start );
    walkersInArea.insert( walkersInArea.end(), wlkOnTile.begin(), wlkOnTile.end() );
  }
  else
  {
    gfx::TilesArea area( _parent.rcity.tilemap(), start, stop );
    for( auto& tile : area)
    {
      const WalkerList& wlkOnTile = _parent.rcity.walkers( tile->pos() );
      walkersInArea.insert( walkersInArea.end(), wlkOnTile.begin(), wlkOnTile.end() );
    }
  }

  SmartList< T > result;
  for( auto& w : walkersInArea )
  {
    if( w->type() == type || type == walker::any )
      result.addIfValid( w.as<T>() );
  }

  return result;
}