diff options
Diffstat (limited to 'map.c')
| -rw-r--r-- | map.c | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -37,7 +37,7 @@ unsigned int neighbours_4dir(Position neighbour_array[4], size_t cost_array[4], neighbour_array[cur].x = pos.x - 1; neighbour_array[cur].y = pos.y; if (cost_array != NULL) { - if (costs != NULL) cost_array[cur] = costs[pos.y][pos.x - 1]; + if (costs != NULL) cost_array[cur] = costs[pos.y][pos.x - 1] * COST_ORTHOGONAL; else cost_array[cur] = COST_ORTHOGONAL; } cur += 1; @@ -46,7 +46,7 @@ unsigned int neighbours_4dir(Position neighbour_array[4], size_t cost_array[4], neighbour_array[cur].x = pos.x + 1; neighbour_array[cur].y = pos.y; if (cost_array != NULL) { - if (costs != NULL) cost_array[cur] = costs[pos.y][pos.x + 1]; + if (costs != NULL) cost_array[cur] = costs[pos.y][pos.x + 1] * COST_ORTHOGONAL; else cost_array[cur] = COST_ORTHOGONAL; } cur += 1; @@ -55,7 +55,7 @@ unsigned int neighbours_4dir(Position neighbour_array[4], size_t cost_array[4], neighbour_array[cur].x = pos.x; neighbour_array[cur].y = pos.y - 1; if (cost_array != NULL) { - if (costs != NULL) cost_array[cur] = costs[pos.y - 1][pos.x]; + if (costs != NULL) cost_array[cur] = costs[pos.y - 1][pos.x] * COST_ORTHOGONAL; else cost_array[cur] = COST_ORTHOGONAL; } cur += 1; @@ -64,7 +64,7 @@ unsigned int neighbours_4dir(Position neighbour_array[4], size_t cost_array[4], neighbour_array[cur].x = pos.x; neighbour_array[cur].y = pos.y + 1; if (cost_array != NULL) { - if (costs != NULL) cost_array[cur] = costs[pos.y + 1][pos.x]; + if (costs != NULL) cost_array[cur] = costs[pos.y + 1][pos.x] * COST_ORTHOGONAL; else cost_array[cur] = COST_ORTHOGONAL; } cur += 1; @@ -80,7 +80,7 @@ unsigned int neighbours_8dir(Position neighbour_array[8], size_t cost_array[8], neighbour_array[cur].x = pos.x - 1; neighbour_array[cur].y = pos.y; if (cost_array != NULL) { - if (costs != NULL) cost_array[cur] = costs[pos.y][pos.x - 1]; + if (costs != NULL) cost_array[cur] = costs[pos.y][pos.x - 1] * COST_ORTHOGONAL; else cost_array[cur] = COST_ORTHOGONAL; } cur += 1; @@ -89,7 +89,7 @@ unsigned int neighbours_8dir(Position neighbour_array[8], size_t cost_array[8], neighbour_array[cur].x = pos.x + 1; neighbour_array[cur].y = pos.y; if (cost_array != NULL) { - if (costs != NULL) cost_array[cur] = costs[pos.y][pos.x + 1]; + if (costs != NULL) cost_array[cur] = costs[pos.y][pos.x + 1] * COST_ORTHOGONAL; else cost_array[cur] = COST_ORTHOGONAL; } cur += 1; @@ -98,7 +98,7 @@ unsigned int neighbours_8dir(Position neighbour_array[8], size_t cost_array[8], neighbour_array[cur].x = pos.x; neighbour_array[cur].y = pos.y - 1; if (cost_array != NULL) { - if (costs != NULL) cost_array[cur] = costs[pos.y - 1][pos.x]; + if (costs != NULL) cost_array[cur] = costs[pos.y - 1][pos.x] * COST_ORTHOGONAL; else cost_array[cur] = COST_ORTHOGONAL; } cur += 1; @@ -107,7 +107,7 @@ unsigned int neighbours_8dir(Position neighbour_array[8], size_t cost_array[8], neighbour_array[cur].x = pos.x; neighbour_array[cur].y = pos.y + 1; if (cost_array != NULL) { - if (costs != NULL) cost_array[cur] = costs[pos.y + 1][pos.x]; + if (costs != NULL) cost_array[cur] = costs[pos.y + 1][pos.x] * COST_ORTHOGONAL; else cost_array[cur] = COST_ORTHOGONAL; } cur += 1; @@ -117,7 +117,7 @@ unsigned int neighbours_8dir(Position neighbour_array[8], size_t cost_array[8], neighbour_array[cur].x = pos.x - 1; neighbour_array[cur].y = pos.y - 1; if (cost_array != NULL) { - if (costs != NULL) cost_array[cur] = costs[pos.y - 1][pos.x - 1]; + if (costs != NULL) cost_array[cur] = costs[pos.y - 1][pos.x - 1] * COST_DIAGONAL; else cost_array[cur] = COST_DIAGONAL; } cur += 1; @@ -126,7 +126,7 @@ unsigned int neighbours_8dir(Position neighbour_array[8], size_t cost_array[8], neighbour_array[cur].x = pos.x + 1; neighbour_array[cur].y = pos.y - 1; if (cost_array != NULL) { - if (costs != NULL) cost_array[cur] = costs[pos.y - 1][pos.x + 1]; + if (costs != NULL) cost_array[cur] = costs[pos.y - 1][pos.x + 1] * COST_DIAGONAL; else cost_array[cur] = COST_DIAGONAL; } cur += 1; @@ -135,7 +135,7 @@ unsigned int neighbours_8dir(Position neighbour_array[8], size_t cost_array[8], neighbour_array[cur].x = pos.x + 1; neighbour_array[cur].y = pos.y + 1; if (cost_array != NULL) { - if (costs != NULL) cost_array[cur] = costs[pos.y + 1][pos.x + 1]; + if (costs != NULL) cost_array[cur] = costs[pos.y + 1][pos.x + 1] * COST_DIAGONAL; else cost_array[cur] = COST_DIAGONAL; } cur += 1; @@ -144,7 +144,7 @@ unsigned int neighbours_8dir(Position neighbour_array[8], size_t cost_array[8], neighbour_array[cur].x = pos.x - 1; neighbour_array[cur].y = pos.y + 1; if (cost_array != NULL) { - if (costs != NULL) cost_array[cur] = costs[pos.y + 1][pos.x - 1]; + if (costs != NULL) cost_array[cur] = costs[pos.y + 1][pos.x - 1] * COST_DIAGONAL; else cost_array[cur] = COST_DIAGONAL; } cur += 1; |
