|
@@ -86,8 +86,8 @@ int do_astar(void)
|
|
get_slope2(alt_val, alt_nbr[ct_dir],
|
|
get_slope2(alt_val, alt_nbr[ct_dir],
|
|
dist_to_nbr[ct_dir]);
|
|
dist_to_nbr[ct_dir]);
|
|
}
|
|
}
|
|
- if (!is_worked) {
|
|
|
|
- if (ct_dir > 3 && slope[ct_dir] >= 0) {
|
|
|
|
|
|
+ if (!is_in_list || (!is_worked && af.asp < 0)) {
|
|
|
|
+ if (ct_dir > 3 && slope[ct_dir] > 0) {
|
|
if (slope[nbr_ew[ct_dir]] >= 0) {
|
|
if (slope[nbr_ew[ct_dir]] >= 0) {
|
|
/* slope to ew nbr > slope to center */
|
|
/* slope to ew nbr > slope to center */
|
|
if (slope[ct_dir] <
|
|
if (slope[ct_dir] <
|
|
@@ -107,16 +107,16 @@ int do_astar(void)
|
|
|
|
|
|
if (!skip_diag) {
|
|
if (!skip_diag) {
|
|
/* add neighbour as new point if not in the list */
|
|
/* add neighbour as new point if not in the list */
|
|
- if (is_in_list == 0) {
|
|
|
|
|
|
+ if (!is_in_list) {
|
|
/* set flow direction */
|
|
/* set flow direction */
|
|
af.asp = drain[upr - r + 1][upc - c + 1];
|
|
af.asp = drain[upr - r + 1][upc - c + 1];
|
|
add_pt(upr, upc, alt_nbr[ct_dir]);
|
|
add_pt(upr, upc, alt_nbr[ct_dir]);
|
|
FLAG_SET(af.flag, INLISTFLAG);
|
|
FLAG_SET(af.flag, INLISTFLAG);
|
|
seg_put(&aspflag, (char *)&af, upr, upc);
|
|
seg_put(&aspflag, (char *)&af, upr, upc);
|
|
}
|
|
}
|
|
- else if (is_in_list && is_worked == 0 && slope[ct_dir] > 0) {
|
|
|
|
|
|
+ else if (!is_worked) {
|
|
/* neighbour is edge in list, not yet worked */
|
|
/* neighbour is edge in list, not yet worked */
|
|
- if (af.asp < 0) {
|
|
|
|
|
|
+ if (af.asp < 0 && slope[ct_dir] > 0) {
|
|
/* adjust flow direction for edge cell */
|
|
/* adjust flow direction for edge cell */
|
|
af.asp = drain[upr - r + 1][upc - c + 1];
|
|
af.asp = drain[upr - r + 1][upc - c + 1];
|
|
seg_put(&aspflag, (char *)&af, upr, upc);
|
|
seg_put(&aspflag, (char *)&af, upr, upc);
|