From 9478e2c2bebc5068dbcb57b8e42fe5baf1719438 Mon Sep 17 00:00:00 2001 From: Tim Sarbin Date: Sat, 8 Feb 2020 21:33:14 -0500 Subject: [PATCH] Fixed pathfinding crash (#301) --- d2core/d2map/region.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/d2core/d2map/region.go b/d2core/d2map/region.go index a4e578349..9ea0f0aae 100644 --- a/d2core/d2map/region.go +++ b/d2core/d2map/region.go @@ -154,10 +154,10 @@ func loadRegion(seed int64, tileOffsetX, tileOffsetY int, levelType d2enum.Regio func (mr *MapRegion) generateWalkableMatrix() { mr.walkableArea = make([][]PathTile, mr.tileRect.Height*5) - for y := 0; y < mr.tileRect.Height*5; y++ { + for y := 0; y < (mr.tileRect.Height - 1)*5; y++ { mr.walkableArea[y] = make([]PathTile, mr.tileRect.Width*5) ty := int(float64(y) / 5.0) - for x := 0; x < mr.tileRect.Width*5; x++ { + for x := 0; x < (mr.tileRect.Width-1)*5; x++ { tx := int(float64(x) / 5.0) tile := mr.GetTile(tx, ty) isBlocked := false