diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-02-26 00:19:48 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-01-27 16:43:52 +0100 |
| commit | fe0cfc82c6cf3d3576de94e0f8b294761067af81 (patch) | |
| tree | 0614d392bf60d684c1a07f261c48f632b4650393 | |
| parent | db469da2704f703d15e81f5e44ba157c10a21e77 (diff) | |
| download | muhqs-game-fe0cfc82c6cf3d3576de94e0f8b294761067af81.tar.gz muhqs-game-fe0cfc82c6cf3d3576de94e0f8b294761067af81.zip | |
intermediate commit
* use names for pile perm choice
* fix PocList hover segfault
* prevent mysterius autogenerated playTargets segfault
| -rw-r--r-- | go/client/game.go | 4 | ||||
| -rw-r--r-- | go/game/cardImplementations.go | 4 | ||||
| -rw-r--r-- | go/ui/hoverable.go | 6 |
3 files changed, 10 insertions, 4 deletions
diff --git a/go/client/game.go b/go/client/game.go index bbfb6643..0e516815 100644 --- a/go/client/game.go +++ b/go/client/game.go @@ -206,9 +206,11 @@ func (g *Game) addPermActionChoice(perm game.Permanent, x, y int) { } perms := []game.Permanent{perm} + labels := []string{perm.Card().Name} for _, p := range perm.Pile() { if len(p.CurrentlyAvailActions()) > 0 { perms = append(perms, p) + labels = append(labels, p.Card().Name) } } @@ -219,7 +221,7 @@ func (g *Game) addPermActionChoice(perm game.Permanent, x, y int) { p := perms[c.GetChoosen(x, y)] g.addActionChoice(p, x, y) } - g.addChoice(ui.NewPermChoice(x, y, perms, onClick)) + g.addChoice(ui.NewChoice(x, y, utils.TypedSliceToInterfaceSlice(labels), onClick)) } else { g.selectedObject = perms[0] g.addActionChoice(perms[0], x, y) diff --git a/go/game/cardImplementations.go b/go/game/cardImplementations.go index 52ffee98..66c77b18 100644 --- a/go/game/cardImplementations.go +++ b/go/game/cardImplementations.go @@ -522,7 +522,7 @@ func (i *frostPylonImpl) onLeaving(t *Tile) { } } -type giganticHailImpl struct{ +type giganticHailImpl struct { cardImplementation } @@ -586,6 +586,8 @@ func (*tentacleSlapImpl) onPlay(s *State, _ *Card, kraken *Player, _ *Targets) { type unholyCannonballImpl struct{ cardImplementation } +func (*unholyCannonballImpl) playTargets() TargetDesc { return INVALID_TARGET_DESC } + func (*unholyCannonballImpl) onPlay(s *State, _ *Card, kraken *Player, _ *Targets) { krakenTiles := s.Map.FilterTiles(func(t *Tile) bool { return t.Raw == "the kraken" }) if len(krakenTiles) != 1 { diff --git a/go/ui/hoverable.go b/go/ui/hoverable.go index 54d4ec15..30415c8d 100644 --- a/go/ui/hoverable.go +++ b/go/ui/hoverable.go @@ -62,11 +62,13 @@ type hoverCardView struct { func (h *hoverCardView) init(w Widget) { h.createHint = func(x, y int) Widget { - card := w.FindObjectAt(x, y).(*game.Card) - if card == nil { + obj := w.FindObjectAt(x, y) + if obj == nil { return nil } + card := obj.(*game.Card) + wx, wy := x, y if x+HOVER_CARD_WIDTH > h.xMax || y+HOVER_CARD_HEIGHT > h.yMax { wx = x - HOVER_CARD_WIDTH |
