aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-02-05 23:14:19 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2025-01-27 16:43:47 +0100
commit1a2ee6899d8243c5f55f48fe48ef73f3f2507e35 (patch)
tree1f60c8230bc862f73077fec140c0a9c3890b63c7
parente9070ef3752c5d2ab1f9faac48095995772ce726 (diff)
downloadmuhqs-game-1a2ee6899d8243c5f55f48fe48ef73f3f2507e35.tar.gz
muhqs-game-1a2ee6899d8243c5f55f48fe48ef73f3f2507e35.zip
fix some warnings reported by golang-ci
-rw-r--r--go/client/main.go8
-rw-r--r--go/game/cardImplementations.go4
-rw-r--r--go/game/kraken.go3
-rw-r--r--go/game/map.go2
-rw-r--r--go/game/state.go2
-rw-r--r--go/game/targets.go3
-rw-r--r--go/game/unit_test.go2
7 files changed, 9 insertions, 15 deletions
diff --git a/go/client/main.go b/go/client/main.go
index 3635404f..632bcc13 100644
--- a/go/client/main.go
+++ b/go/client/main.go
@@ -22,17 +22,13 @@ var playerColors = []color.RGBA{
{1, 1, 0xff, 0xff},
}
-var (
- playerName string
- startDeckPath string
-)
+var startDeckPath string
type app struct {
windowWidth int
windowHeight int
- active ebiten.Game
- running bool
+ active ebiten.Game
}
func (a *app) Update() error {
diff --git a/go/game/cardImplementations.go b/go/game/cardImplementations.go
index be625211..99994a41 100644
--- a/go/game/cardImplementations.go
+++ b/go/game/cardImplementations.go
@@ -8,7 +8,7 @@ type advisorImplementation struct {
cardImplementationBase
}
-func (impl *advisorImplementation) fullAction(u *Unit) []*FullAction {
+func (impl *advisorImplementation) fullActions(u *Unit) []*FullAction {
resolvePrototype := func(a Action) ActionResolveFunc {
u := a.Source().(*Unit)
return func(s *State) {
@@ -27,7 +27,7 @@ type missionaryImplementation struct {
cardImplementationBase
}
-func (impl *missionaryImplementation) fullAction(u *Unit) []*FullAction {
+func (impl *missionaryImplementation) fullActions(u *Unit) []*FullAction {
resolvePrototype := func(a Action) ActionResolveFunc {
u := a.Source().(*Unit)
target := a.Targets().sel[0].(*Unit)
diff --git a/go/game/kraken.go b/go/game/kraken.go
index d39cbaa3..baf9a07b 100644
--- a/go/game/kraken.go
+++ b/go/game/kraken.go
@@ -101,8 +101,7 @@ turn:
}
kraken.Hand.AddCard(c)
- var costFunc ActionCostFunc
- costFunc = func(s *State) bool {
+ var costFunc ActionCostFunc = func(s *State) bool {
kraken.Resource -= c.BuyCost
return true
}
diff --git a/go/game/map.go b/go/game/map.go
index cab18f26..2115e0b0 100644
--- a/go/game/map.go
+++ b/go/game/map.go
@@ -286,7 +286,7 @@ func (m *Map) distributeStoreCards(cards PileOfCards, rand *rand.Rand) {
}
}
-func (m *Map) redistributeStoreCards(cards PileOfCards, rand *rand.Rand) {
+func (m *Map) redistributeStoreCards(rand *rand.Rand) {
poc := NewPileOfCards()
for _, store := range m.Stores {
store.MoveInto(poc)
diff --git a/go/game/state.go b/go/game/state.go
index 35aeb342..744f0b11 100644
--- a/go/game/state.go
+++ b/go/game/state.go
@@ -220,7 +220,7 @@ func (s *State) pushAction(a Action) {
}
func (s *State) DeclareAction(a Action) {
- var err error = nil
+ var err error
err = a.CheckTargets(s)
diff --git a/go/game/targets.go b/go/game/targets.go
index 046c53d6..7803c2c8 100644
--- a/go/game/targets.go
+++ b/go/game/targets.go
@@ -20,7 +20,6 @@ type (
type Targets struct {
s *State
- action Action
constraints []*TargetConstraint
sel []interface{}
}
@@ -40,7 +39,7 @@ func (t *Targets) String() string {
}
if len(t.sel) == 1 {
- return fmt.Sprintf("%s", fmtSel(t.sel[0]))
+ return fmtSel(t.sel[0])
}
s := "["
diff --git a/go/game/unit_test.go b/go/game/unit_test.go
index d6b5b079..0f16176c 100644
--- a/go/game/unit_test.go
+++ b/go/game/unit_test.go
@@ -22,7 +22,7 @@ symbols:
s.Map, _ = readMap(r)
f := NewUnit(NewCard("nautics/fisher"), s.Map.TileAt(Position{2, 2}), nil)
a := NewUnit(NewCard("base/archer"), s.Map.TileAt(Position{1, 1}), nil)
- sword := newEquipment(NewCard("base/sword"), s.Map.TileAt(Position{0, 1}), nil)
+ sword := newEquipmentFromPath("base/sword", s.Map.TileAt(Position{0, 1}), nil)
a.move(s, f.Tile())
if len(f.Pile()) != 1 {