* @brief heuristic, estimated cost from (sx,sy) to (dx,dy) */
| 90 | * @brief heuristic, estimated cost from (sx,sy) to (dx,dy) |
| 91 | */ |
| 92 | int path_get_h_cost(int sx, int sy, int dx, int dy) |
| 93 | { |
| 94 | int delta_x = abs(sx - dx); |
| 95 | int delta_y = abs(sy - dy); |
| 96 | |
| 97 | int min = delta_x < delta_y ? delta_x : delta_y; |
| 98 | int max = delta_x > delta_y ? delta_x : delta_y; |
| 99 | |
| 100 | // see path_check_equal for why this is times 2 |
| 101 | return 2 * (min + max); |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * @brief return 2 if pPath is horizontally/vertically aligned with (dx,dy), else 3 |
no outgoing calls
no test coverage detected