diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-02-24 13:48:33 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-01-27 16:43:51 +0100 |
| commit | 9e082b76ad5e0f90814bc88265149a6541b8fb45 (patch) | |
| tree | d32aab723a05335dba53b68023f9b70e1148c1ba /go/ui | |
| parent | 7788121beb6b9dd8540d4345e8e841830ff2c490 (diff) | |
| download | muhqs-game-9e082b76ad5e0f90814bc88265149a6541b8fb45.tar.gz muhqs-game-9e082b76ad5e0f90814bc88265149a6541b8fb45.zip | |
intermeditae commit
* implement dopping piles
* implement simple spell targeting
* add some simple spells
Diffstat (limited to 'go/ui')
| -rw-r--r-- | go/ui/collection.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/go/ui/collection.go b/go/ui/collection.go index 027d0d99..e2b3ffa8 100644 --- a/go/ui/collection.go +++ b/go/ui/collection.go @@ -5,6 +5,7 @@ import ( "github.com/hajimehoshi/ebiten/v2" "github.com/hajimehoshi/ebiten/v2/inpututil" + "golang.org/x/exp/slices" ) type Collection struct { @@ -33,6 +34,9 @@ func (c *Collection) AddWidget(w Widget) { if w == nil { log.Panicf("Adding nil widget to collection") } + if slices.Contains(c.widgets, w) { + log.Panicf("Double insertion of", w) + } c.widgets = append(c.widgets, w) } |
