Flatten digWallGap

This commit is contained in:
2026-07-22 21:59:44 +07:00
parent 432ea4f019
commit 3e1c30c787

View File

@@ -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
// (rooms.c dig).
func digWallGap(m *mazeState, y, x, nexty, nextx int) Coord {
var pos Coord
if nexty == y {
pos.Y = y + m.starty
pos := Coord{Y: y + m.starty, X: nextx + m.startx - 1}
if nextx-x < 0 {
pos.X = nextx + m.startx + 1
} else {
pos.X = nextx + m.startx - 1
}
} else {
pos.X = x + m.startx
if nexty-y < 0 {
pos.Y = nexty + m.starty + 1
} else {
pos.Y = nexty + m.starty - 1
}
return pos
}
pos := Coord{X: x + m.startx, Y: nexty + m.starty - 1}
if nexty-y < 0 {
pos.Y = nexty + m.starty + 1
}
return pos