aboutsummaryrefslogtreecommitdiff
path: root/go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2025-10-07 21:35:52 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2025-10-08 10:48:55 +0200
commit6a0013c62f24654529fd589a7de486bf1888a63b (patch)
tree0f5f4787514062ecd0380f316fffed73a2890183 /go
parent0bc5bd306f274aa60b075fd8e0167e1ee4f28845 (diff)
downloadmuhqs-game-6a0013c62f24654529fd589a7de486bf1888a63b.tar.gz
muhqs-game-6a0013c62f24654529fd589a7de486bf1888a63b.zip
minor code improvements (staticcheck)
Diffstat (limited to 'go')
-rw-r--r--go/game/winCondition.go2
-rw-r--r--go/ui/buffer.go6
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]
}