From 6a0013c62f24654529fd589a7de486bf1888a63b Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Tue, 7 Oct 2025 21:35:52 +0200 Subject: minor code improvements (staticcheck) --- go/game/winCondition.go | 2 +- go/ui/buffer.go | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/go/game/winCondition.go b/go/game/winCondition.go index 0a97330c..ab73dcb5 100644 --- a/go/game/winCondition.go +++ b/go/game/winCondition.go @@ -87,7 +87,7 @@ var KingGame = &winCondition{ } nPlayers := len(s.Players()) - loosers := make([]*Player, nPlayers, nPlayers) + loosers := make([]*Player, nPlayers) copy(loosers, s.Players()) for p := range foundKings { // Considere players who have conceded as loosers diff --git a/go/ui/buffer.go b/go/ui/buffer.go index c44bbdd0..50044163 100644 --- a/go/ui/buffer.go +++ b/go/ui/buffer.go @@ -47,7 +47,7 @@ func NewBuffer(x, y int, width, height int) *Buffer { func (b *Buffer) render() *ebiten.Image { img := ebiten.NewImage(b.Width, b.Height) img.Fill(b.bg) - var y float64 = -b.font.Size + y := -b.font.Size for i, line := range b.lines[b.pos:] { _, h := text.Measure(line, b.font, b.font.Size*b.lineSpacing) y += h @@ -177,9 +177,7 @@ func (b *StackBuffer) RemoveLast() { // Remove potential highlight i := len(b.actions) - 1 - if _, found := b.highlights[i]; found { - delete(b.highlights, i) - } + delete(b.highlights, i) b.actions = b.actions[:i] } -- cgit v1.2.3