2 * A* Search - A search library used in Empire to determine paths between
4 * Copyright (C) 1990-1998 Phil Lapsley
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #if !defined(lint) && !defined(SABER)
25 static char sccsid[] = "@(#)as_delete.c 1.5 11/13/90";
28 static void as_free_queue(struct as_queue *queue);
31 * Free any dynamically allocated data stored in the as_data structure.
34 as_reset(struct as_data *adp)
37 as_free_queue(adp->head);
39 as_free_queue(adp->tried);
41 as_free_queue(adp->subsumed);
44 as_free_path(adp->path);
49 * Free a queue (either the main, subsumed, or tried).
52 as_free_queue(struct as_queue *queue)
54 struct as_queue *qp, *qp2;
56 for (qp = queue; qp; qp = qp2) {
57 free((s_char *)qp->np);
67 as_free_path(struct as_path *pp)
71 for (; pp; pp = pp2) {
78 * Delete the as_data structure (which includes freeing its data).
81 as_delete(struct as_data *adp)
84 free((s_char *)adp->neighbor_coords);
85 free((s_char *)adp->neighbor_nodes);
86 free((s_char *)adp->hashtab);