Flatten digWallGap
This commit is contained in:
@@ -264,21 +264,18 @@ func (g *RogueGame) digPick(y, x int) (int, int, bool) {
|
|||||||
// digWallGap picks the wall square to knock out between two maze cells
|
// digWallGap picks the wall square to knock out between two maze cells
|
||||||
// (rooms.c dig).
|
// (rooms.c dig).
|
||||||
func digWallGap(m *mazeState, y, x, nexty, nextx int) Coord {
|
func digWallGap(m *mazeState, y, x, nexty, nextx int) Coord {
|
||||||
var pos Coord
|
|
||||||
if nexty == y {
|
if nexty == y {
|
||||||
pos.Y = y + m.starty
|
pos := Coord{Y: y + m.starty, X: nextx + m.startx - 1}
|
||||||
if nextx-x < 0 {
|
if nextx-x < 0 {
|
||||||
pos.X = nextx + m.startx + 1
|
pos.X = nextx + m.startx + 1
|
||||||
} else {
|
|
||||||
pos.X = nextx + m.startx - 1
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
pos.X = x + m.startx
|
return pos
|
||||||
|
}
|
||||||
|
|
||||||
|
pos := Coord{X: x + m.startx, Y: nexty + m.starty - 1}
|
||||||
if nexty-y < 0 {
|
if nexty-y < 0 {
|
||||||
pos.Y = nexty + m.starty + 1
|
pos.Y = nexty + m.starty + 1
|
||||||
} else {
|
|
||||||
pos.Y = nexty + m.starty - 1
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return pos
|
return pos
|
||||||
|
|||||||
Reference in New Issue
Block a user