remove path.count redundancy

This commit is contained in:
2026-07-06 01:25:57 -07:00
parent a3f760e1f1
commit 85c22cf74b
2 changed files with 4 additions and 10 deletions
-6
View File
@@ -2,14 +2,12 @@ package main
Path :: struct {
tiles: [dynamic]Tile_Coord,
count: int,
}
max_path_int :: 1_000_000_000
path_clear :: proc(path: ^Path) {
resize(&path.tiles, 0)
path.count = 0
}
pathfind_bfs :: proc(tilemap: ^Tilemap, start, goal: Tile_Coord, path: ^Path) -> bool {
@@ -18,7 +16,6 @@ pathfind_bfs :: proc(tilemap: ^Tilemap, start, goal: Tile_Coord, path: ^Path) ->
if start == goal {
resize(&path.tiles, 1)
path.tiles[0] = start
path.count = 1
return true
}
@@ -83,7 +80,6 @@ pathfind_astar :: proc(tm: ^Tilemap, start, goal: Tile_Coord, path: ^Path) -> bo
if start == goal {
resize(&path.tiles, 1)
path.tiles[0] = start
path.count = 1
return true
}
@@ -198,7 +194,6 @@ path_reconstruct :: proc(
}
resize(&path.tiles, rev_count)
path.count = rev_count
for i in 0 ..< rev_count {
path.tiles[i] = rev[rev_count - 1 - i]
@@ -210,6 +205,5 @@ path_reconstruct :: proc(
path_destroy :: proc(path: ^Path) {
delete(path.tiles)
path.tiles = nil
path.count = 0
}