// KeepCC puts walls in all the positions unreachable from p according to last
// CCMap or CCMapAll call on pr. Paths are supposed to be bidirectional. It
// returns the number of cells in the remaining connected component.
KeepCC puts walls in all the positions unreachable from p according to last
CCMap or CCMapAll call on pr. Paths are supposed to be bidirectional. It
returns the number of cells in the remaining connected component.
// KeepCC puts walls in all the positions unreachable from p according to last // CCMap or CCMapAll call on pr . Paths are supposed to be bidirectional . It // returns the number of cells in the remaining connected component .
func (mg MapGen) KeepCC(pr *paths.PathRange, p gruid.Point, wall Cell) int {
	id := pr.CCMapAt(p)
	if id == -1 {
		mg.Grid.Fill(wall)
		return 0
	}
	count := 0
	it := mg.Grid.Iterator()
	for it.Next() {
		if pr.CCMapAt(it.P()) != id {
			it.SetCell(wall)
		} else {
			count++
		}
	}
	return count
}
func ( mg MapGen ) KeepCC ( pr * paths . PathRange , p gruid . Point , wall Cell ) int { id := pr . CCMapAt ( p ) if id == - 1 { mg . Grid . Fill ( wall ) return 0 } count := 0 it := mg . Grid . Iterator ( ) for it . Next ( ) { if pr . CCMapAt ( it . P ( ) ) != id { it . SetCell ( wall ) } else { count ++ } } return count }
KeepCC puts walls in all the positions unreachable from p according to last
CCMap or CCMapAll call on pr.
KeepCC puts walls in all the positions unreachable from p according to last CCMap or CCMapAll call on pr .