aboutsummaryrefslogtreecommitdiff
path: root/go/ui/mapView.go
diff options
context:
space:
mode:
Diffstat (limited to 'go/ui/mapView.go')
-rw-r--r--go/ui/mapView.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/go/ui/mapView.go b/go/ui/mapView.go
index 8c83bd41..a6fd55c1 100644
--- a/go/ui/mapView.go
+++ b/go/ui/mapView.go
@@ -150,8 +150,12 @@ func (vw *MapView) drawPermanentsLayer(screen *ebiten.Image) {
vw.permanentsLayer = vw.newLayerImage()
for i, p := range vw.gameState.Permanents {
- permanentSymbol := getPermanentSymbol(p, i)
t := p.Tile()
+ // Skip permanents with no containing tiles (e.g. piled ones)
+ if t == nil {
+ continue
+ }
+ permanentSymbol := getPermanentSymbol(p, i)
x_px := t.Position.X*TILE_WIDTH + (TILE_WIDTH-PERMANENT_WIDTH)/2
y_px := t.Position.Y*TILE_HEIGHT + (TILE_HEIGHT-PERMANENT_HEIGHT)/2
@@ -206,7 +210,11 @@ func (vw *MapView) FindObjectAt(screenX, screenY int) interface{} {
relativeY >= yMargin && relativeY <= TILE_HEIGHT-yMargin {
for _, p := range vw.gameState.Permanents {
- pos := p.Tile().Position
+ t := p.Tile()
+ if t == nil {
+ continue
+ }
+ pos := t.Position
if pos.X == x && pos.Y == y {
if isSymbolTransparentAt(p, relativeX, relativeY) {
break