< index < 13. Path finding < 13.3 Reading path information | ===================================== 13.4 Destroying a path ===================================== |

To release the resources used by a path, destroy it with :

    C++ : TCODPath::~TCODPath()
          TCODDijkstra::~TCODDijkstra()
    C   : void TCOD_path_delete(TCOD_path_t path)
          void TCOD_dijkstra_delete(TCOD_dijkstra_t dijkstra)
    Py  : path_delete(path)
          dijkstra_delete(dijkstra)

Parameter | Description
--- | ---
path | In the C version, the path handler returned by one of the TCOD_path_new_* function.
dijkstra | In the C version, the path handler returned by one of the TCOD_dijkstra_new* function.

Example :

    C++ : TCODPath *path = new TCODPath(myMap); // allocate the path
          // use the path...
          delete path; // destroy the path

          TCODDijkstra *dijkstra = new TCODDijkstra(myMap); // allocate the path
          // use the path...
          delete dijkstra; // destroy the path

    C   : TCOD_path_t path = TCOD_path_new_using_map(my_map);
          /* use the path ... */
          TCOD_path_delete(path);

          TCOD_dijkstra_t dijkstra = TCOD_dijkstra_new(my_map);
          /* use the path ... */
          TCOD_dijkstra_delete(dijkstra);

    Py  : path = libtcod.path_new_using_map(my_map)
          # use the path ...
          libtcod.path_delete(path)

          dijkstra = libtcod.dijkstra_new(my_map)
          # use the path ...
          libtcod.dijkstra_delete(dijkstra)