@@ -911,7 +911,12 @@ static astar_node *auto_create_astar_node(short x, short y, short x_parent,
911911 *
912912 * Returns 1 if it found a path and 0 if it doesn't
913913 */
914- int astar_compare (int a , int b , void * arg ) { return a - b ; }
914+ static int astar_compare (void * left_key , void * right_key , void * arg ) {
915+ const long left = (long )left_key ;
916+ const long right = (long )right_key ;
917+
918+ return (left > right ) - (left < right );
919+ }
915920void astar_release (void * key , void * data ) { free (data ); }
916921int auto_astar_generate_path (AUTO * autopilot , MECH * mech , short end_x ,
917922 short end_y ) {
@@ -964,9 +969,9 @@ int auto_astar_generate_path(AUTO *autopilot, MECH *mech, short end_x,
964969 memset (open_list_bitfield , 0 , sizeof (open_list_bitfield ));
965970
966971 /* Setup the trees */
967- open_list_by_score = red_black_tree_init (( void * ) astar_compare , NULL );
968- open_list_by_xy = red_black_tree_init (( void * ) astar_compare , NULL );
969- closed_list = red_black_tree_init (( void * ) astar_compare , NULL );
972+ open_list_by_score = red_black_tree_init (astar_compare , NULL );
973+ open_list_by_xy = red_black_tree_init (astar_compare , NULL );
974+ closed_list = red_black_tree_init (astar_compare , NULL );
970975
971976 /* Setup the path */
972977 /* Destroy any existing path first */
0 commit comments