Fix an off by one bug... the tests didn't catch this one :\
This commit is contained in:
parent
63cad2404c
commit
7658210da4
1 changed files with 2 additions and 2 deletions
|
@ -286,11 +286,11 @@ public class DiamondSquareGenerator: TerrainGenerator {
|
|||
return [n, w, s, e].map { (p: Point) -> Point in
|
||||
if p.x < 0 {
|
||||
return Point(x: p.x + grid.size.w - 1, y: p.y)
|
||||
} else if p.x > grid.size.w {
|
||||
} else if p.x >= grid.size.w {
|
||||
return Point(x: p.x - grid.size.w + 1, y: p.y)
|
||||
} else if p.y < 0 {
|
||||
return Point(x: p.x, y: p.y + grid.size.h - 1)
|
||||
} else if p.y > grid.size.h {
|
||||
} else if p.y >= grid.size.h {
|
||||
return Point(x: p.x, y: p.y - grid.size.h + 1)
|
||||
} else {
|
||||
return p
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue