From 2ee42003433b2faeda4ded1bc6557a6eaf3720ff Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Sat, 28 Dec 2024 11:38:44 +0100 Subject: improve code * explicitly ignore errors where appropriate * do not append in a loop * specify format string in Errorf --- go/game/ai.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'go/game/ai.go') 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 -- cgit v1.2.3