< index < 14. BSP toolkit < 14.5 Traversing the tree |
===================================== |
C++ : void TCODBsp::removeSons() C : void TCOD_bsp_remove_sons(TCOD_bsp_t *node) Py : bsp_remove_sons(node)
Parameter | Description |
---|---|
node | In the C version, the node reference. |
C++ : TCODBsp *myBSP = new TCODBsp(0,0,50,50); // create a tree myBSP->splitRecursive(NULL,4,5,5,1.5f,1.5f); // clear it (keep only the root) myBSP->removeSons(); // and rebuild another random tree myBSP->splitRecursive(NULL,4,5,5,1.5f,1.5f); C : TCOD_bsp_t *my_bsp=TCOD_bsp_new_with_size(0,0,50,50); TCOD_bsp_split_recursive(my_bsp,NULL,4,5,5,1.5f,1.5f); TCOD_bsp_remove_sons(my_bsp); TCOD_bsp_split_recursive(my_bsp,NULL,4,5,5,1.5f,1.5f); Py : my_bsp=libtcod.bsp_new_with_size(0,0,50,50) libtcod.bsp_split_recursive(my_bsp,0,4,5,5,1.5,1.5) libtcod.bsp_remove_sons(my_bsp) libtcod.bsp_split_recursive(my_bsp,0,4,5,5,1.5,1.5)
C++ : void TCODBsp::~TCODBsp() C : void TCOD_bsp_delete(TCOD_bsp_t *node) Py : bsp_delete(node)
Parameter | Description |
---|---|
node | In the C version, the node reference. |
C++ : TCODBsp *myBSP = new TCODBsp(0,0,50,50); // create a tree myBSP->splitRecursive(NULL,4,5,5,1.5f,1.5f); // use the tree ... // delete the tree delete myBSP; C : TCOD_bsp_t *my_bsp=TCOD_bsp_new_with_size(0,0,50,50); TCOD_bsp_split_recursive(my_bsp,NULL,4,5,5,1.5f,1.5f); /* use the tree ... */ TCOD_bsp_delete(my_bsp); Py : my_bsp=libtcod.bsp_new_with_size(0,0,50,50) libtcod.bsp_split_recursive(my_bsp,0,4,5,5,1.5,1.5) # use the tree ... libtcod.bsp_delete(my_bsp)