void change_item_shape(BrdItem p_item,int p_shape_no,ShapeTile p_new_shape){
  AwtreeNodeLeaf[] old_entries=p_item.get_search_tree_entries(this);
  AwtreeNodeLeaf[] new_leaf_arr=new AwtreeNodeLeaf[old_entries.length];
  ShapeTile[] new_precalculated_tree_shapes=new ShapeTile[old_entries.length];
  remove_leaf(old_entries[p_shape_no]);
  for (int i=0; i < new_precalculated_tree_shapes.length; ++i) {
    if (i == p_shape_no) {
      new_precalculated_tree_shapes[i]=p_new_shape;
    }
 else {
      new_precalculated_tree_shapes[i]=p_item.get_tree_shape(this,i);
      new_leaf_arr[i]=old_entries[i];
    }
  }
  p_item.set_precalculated_tree_shapes(new_precalculated_tree_shapes,this);
  new_leaf_arr[p_shape_no]=insert(p_item,p_shape_no);
  p_item.set_search_tree_entries(this,new_leaf_arr);
}

void change_item_shape ( BrdItem p_item , int p_shape_no , ShapeTile p_new_shape ) { AwtreeNodeLeaf [ ] old_entries = p_item . get_search_tree_entries ( this ) ; AwtreeNodeLeaf [ ] new_leaf_arr = new AwtreeNodeLeaf [ old_entries . length ] ; ShapeTile [ ] new_precalculated_tree_shapes = new ShapeTile [ old_entries . length ] ; remove_leaf ( old_entries [ p_shape_no ] ) ; for ( int i = 0 ; i < new_precalculated_tree_shapes . length ; ++ i ) { if ( i == p_shape_no ) { new_precalculated_tree_shapes [ i ] = p_new_shape ; } else { new_precalculated_tree_shapes [ i ] = p_item . get_tree_shape ( this , i ) ; new_leaf_arr [ i ] = old_entries [ i ] ; } } p_item . set_precalculated_tree_shapes ( new_precalculated_tree_shapes , this ) ; new_leaf_arr [ p_shape_no ] = insert ( p_item , p_shape_no ) ; p_item . set_search_tree_entries ( this , new_leaf_arr ) ; }
changes the shape with index p_shape_no of this item to p_new_shape and updates the entry in the tree .
