void
pms::serialization::spritedesc::node_parser_sprite_declaration::exclude_layers
( const resources::image& image, std::vector<resources::layer>& result,
  const tree_node& node ) const
{
  CLAW_PRECOND( node.value.id() == grammar::id_exclude );
  CLAW_PRECOND( node.children.size() == 2 );

  std::vector<resources::layer> excluded;
  add_layers( image, excluded, node.children[1] );

  for ( std::vector<resources::layer>::iterator it( excluded.begin() );
        it != excluded.end(); ++it )
    {
      std::vector<resources::layer>::iterator candidate( result.begin() );
      bool found(false);

      while ( !found && (candidate != result.end()) )
        if ( candidate->index == it->index )
          {
            found = true;
            result.erase( candidate );
          }
        else
          ++candidate;
    }
}
std::vector<pms::resources::layer>
pms::serialization::spritedesc::node_parser_sprite_declaration::get_layers
( const resources::image& image, const tree_node& layer_list_node ) const
{
  std::vector<resources::layer> result;

  if ( (layer_list_node.value.id() == grammar::id_string)
       || (layer_list_node.value.id() == grammar::id_properties)
       || (layer_list_node.value.id() == grammar::id_glob) )
    add_layers( image, result, layer_list_node );
  else
    for ( std::size_t i(0); i!=layer_list_node.children.size(); ++i )
      add_layers( image, result, layer_list_node.children[i] );

  return result;
}
예제 #3
0
void WorldMapGUI::refresh() {
    MapTileMatrix raw_map = world_map.get_map();
    for(int i = 0; i < height; i++) {
        for(int j = 0; j < width; j++) {
            canvas[i][j] = raw_map[i][j];
        }
    }
    add_layers();
}