aboutsummaryrefslogtreecommitdiff
path: root/go/game/ai.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2024-12-28 11:38:44 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2025-01-27 16:43:59 +0100
commit2ee42003433b2faeda4ded1bc6557a6eaf3720ff (patch)
treeec619361d443732c375fea62853c6a6cb4c4d058 /go/game/ai.go
parent00c718e7c7dd082da6aff619147c156c721861b7 (diff)
downloadmuhqs-game-2ee42003433b2faeda4ded1bc6557a6eaf3720ff.tar.gz
muhqs-game-2ee42003433b2faeda4ded1bc6557a6eaf3720ff.zip
improve code
* explicitly ignore errors where appropriate * do not append in a loop * specify format string in Errorf
Diffstat (limited to 'go/game/ai.go')
-rw-r--r--go/game/ai.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/go/game/ai.go b/go/game/ai.go
index 415f01e0..c55218e3 100644
--- a/go/game/ai.go
+++ b/go/game/ai.go
@@ -291,7 +291,7 @@ func moveAwayFromEnemies(ai *UnitAI) Action {
}
a := NewMoveAction(ai.u)
- a.Target().AddSelection(farest)
+ _ = a.Target().AddSelection(farest)
return a
}
@@ -316,7 +316,7 @@ func actionFromPaths(ai *UnitAI, graph *dijkstra.Graph, paths []*dijkstra.BestPa
for _, id := range paths[nearest].Path[1:] {
mapping, _ := graph.GetMapped(id)
var x, y int
- fmt.Sscanf(mapping, "(%d, %d)", &x, &y)
+ _, _ = fmt.Sscanf(mapping, "(%d, %d)", &x, &y)
nextStep := m.TileAt(Position{X: x, Y: y})
if slices.Contains(ai.u.MoveRangeTiles(m), nextStep) {
target = nextStep