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
26 * Compare the lower bound costs of two nodes. If the two nodes have
27 * equal lower bound costs, sort on the secondary field.
28 * Used as comparision function for qsort.
31 as_costcomp(const void *p1, const void *p2)
33 struct as_node *const *n1 = p1;
34 struct as_node *const *n2 = p2;
37 diff = (*n1)->lbcost - (*n2)->lbcost;
43 /* equal, check secondary cost */
44 diff = (*n1)->seccost - (*n2)->seccost;