RTS: Bug fixing, improvements

This commit is contained in:
Krzosa Karol
2023-04-20 15:52:07 +02:00
parent 6be3b60cd4
commit 7c69537283
2 changed files with 4 additions and 11 deletions

View File

@@ -75,7 +75,7 @@ MAP_SetTargetP :: (s: *MAP_Actor, p: V2I)
Reset(&s.close_paths)
MAP_GetRandomP :: (m: *MAP_Map): V2I
result := V2I{GetRandomValue(0, MAP_CurrentMap.x), GetRandomValue(0, MAP_CurrentMap.y)}
result := V2I{GetRandomValue(0, MAP_CurrentMap.x - 1), GetRandomValue(0, MAP_CurrentMap.y - 1)}
return result
MAP_GetRandomUnblockedP :: (m: *MAP_Map): V2I
@@ -83,6 +83,7 @@ MAP_GetRandomUnblockedP :: (m: *MAP_Map): V2I
p := MAP_GetRandomP(m)
if m.data[p.x + p.y * m.x] == 0
return p
Assert(false, "Invalid codepath")
r: V2I; return r
@@ -209,7 +210,7 @@ MAP_PathFindStep :: (s: *MAP_Actor, compute_history: bool = true): bool
return false
MAP_PathFind :: (s: *MAP_Actor)
for i := 0, i < 128, i += 1
for i := 0, i < 32, i += 1
done := MAP_PathFindStep(s, false)
if done ;; break
MAP_RecomputeHistory(s)