|
@@ -78,7 +78,8 @@ int do_astar(void)
|
|
|
/* get r, c (r_nbr, c_nbr) for neighbours */
|
|
|
r_nbr = r + nextdr[ct_dir];
|
|
|
c_nbr = c + nextdc[ct_dir];
|
|
|
- slope[ct_dir] = ele_nbr[ct_dir] = 0;
|
|
|
+ slope[ct_dir] = -1;
|
|
|
+ ele_nbr[ct_dir] = 0;
|
|
|
skip_diag = 0;
|
|
|
|
|
|
/* check that neighbour is within region */
|
|
@@ -95,16 +96,16 @@ int do_astar(void)
|
|
|
dist_to_nbr[ct_dir]);
|
|
|
}
|
|
|
/* avoid diagonal flow direction bias */
|
|
|
- if (!is_in_list) {
|
|
|
- if (ct_dir > 3 && slope[ct_dir] > 0) {
|
|
|
- if (slope[nbr_ew[ct_dir]] > 0) {
|
|
|
+ if (!is_worked) {
|
|
|
+ if (ct_dir > 3 && slope[ct_dir] >= 0) {
|
|
|
+ if (slope[nbr_ew[ct_dir]] >= 0) {
|
|
|
/* slope to ew nbr > slope to center */
|
|
|
if (slope[ct_dir] <
|
|
|
get_slope(ele_nbr[nbr_ew[ct_dir]],
|
|
|
ele_nbr[ct_dir], ew_res))
|
|
|
skip_diag = 1;
|
|
|
}
|
|
|
- if (!skip_diag && slope[nbr_ns[ct_dir]] > 0) {
|
|
|
+ if (!skip_diag && slope[nbr_ns[ct_dir]] >= 0) {
|
|
|
/* slope to ns nbr > slope to center */
|
|
|
if (slope[ct_dir] <
|
|
|
get_slope(ele_nbr[nbr_ns[ct_dir]],
|