protected override void ResolveInt(ResolveParams parms)
        {
            CellRect outerRect    = parms.rect ?? parms.sketch.OccupiedRect;
            bool     allowWood    = parms.allowWood ?? true;
            ThingDef stuff        = GenStuff.RandomStuffInexpensiveFor(parms.wallEdgeThing, null, (ThingDef x) => SketchGenUtility.IsStuffAllowed(x, allowWood, parms.useOnlyStonesAvailableOnMap, allowFlammableWalls: true, parms.wallEdgeThing));
            Rot4     rot          = ((parms.wallEdgeThing.size.z > parms.wallEdgeThing.size.x) ? Rot4.North : Rot4.East);
            Rot4     rot2         = ((parms.wallEdgeThing.size.z > parms.wallEdgeThing.size.x) ? Rot4.East : Rot4.North);
            CellRect cellRect     = GenAdj.OccupiedRect(default(IntVec3), rot, parms.wallEdgeThing.size);
            CellRect cellRect2    = GenAdj.OccupiedRect(default(IntVec3), rot2, parms.wallEdgeThing.size);
            bool     requireFloor = parms.requireFloor ?? false;

            processed.Clear();
            try
            {
                foreach (IntVec3 item in outerRect.Cells.InRandomOrder())
                {
                    CellRect cellRect3 = SketchGenUtility.FindBiggestRectAt(item, outerRect, parms.sketch, processed, (IntVec3 x) => !parms.sketch.ThingsAt(x).Any() && (!requireFloor || (parms.sketch.TerrainAt(x) != null && parms.sketch.TerrainAt(x).layerable)));
                    if (cellRect3.Width < cellRect.Width || cellRect3.Height < cellRect.Height || cellRect3.Width < cellRect2.Width || cellRect3.Height < cellRect2.Height || !Rand.Chance(0.2f))
                    {
                        continue;
                    }
                    CellRect rect  = new CellRect(cellRect3.minX, cellRect3.CenterCell.z - cellRect.Height / 2, cellRect.Width, cellRect.Height);
                    CellRect rect2 = new CellRect(cellRect3.maxX - (cellRect.Width - 1), cellRect3.CenterCell.z - cellRect.Height / 2, cellRect.Width, cellRect.Height);
                    CellRect rect3 = new CellRect(cellRect3.CenterCell.x - cellRect2.Width / 2, cellRect3.maxZ - (cellRect2.Height - 1), cellRect2.Width, cellRect2.Height);
                    CellRect rect4 = new CellRect(cellRect3.CenterCell.x - cellRect2.Width / 2, cellRect3.minZ, cellRect2.Width, cellRect2.Height);
                    if ((Rand.Bool && CanPlaceAt(rect, Rot4.West, parms.sketch)) || CanPlaceAt(rect2, Rot4.East, parms.sketch))
                    {
                        if (Rand.Bool && CanPlaceAt(rect, Rot4.West, parms.sketch))
                        {
                            parms.sketch.AddThing(parms.wallEdgeThing, new IntVec3(rect.minX - cellRect.minX, 0, rect.minZ - cellRect.minZ), rot, stuff, 1, null, null, wipeIfCollides: false);
                        }
                        else if (CanPlaceAt(rect2, Rot4.East, parms.sketch))
                        {
                            parms.sketch.AddThing(parms.wallEdgeThing, new IntVec3(rect2.minX - cellRect.minX, 0, rect2.minZ - cellRect.minZ), rot, stuff, 1, null, null, wipeIfCollides: false);
                        }
                    }
                    else if (Rand.Bool && CanPlaceAt(rect3, Rot4.North, parms.sketch))
                    {
                        parms.sketch.AddThing(parms.wallEdgeThing, new IntVec3(rect3.minX - cellRect2.minX, 0, rect3.minZ - cellRect2.minZ), rot2, stuff, 1, null, null, wipeIfCollides: false);
                    }
                    else if (CanPlaceAt(rect4, Rot4.South, parms.sketch))
                    {
                        parms.sketch.AddThing(parms.wallEdgeThing, new IntVec3(rect4.minX - cellRect2.minX, 0, rect4.minZ - cellRect2.minZ), rot2, stuff, 1, null, null, wipeIfCollides: false);
                    }
                }
            }
            finally
            {
                processed.Clear();
            }
        }
Example #2
0
        private static bool TryFindFloors(out TerrainDef floor1, out TerrainDef floor2, ResolveParams parms)
        {
            Predicate <TerrainDef> validator = (TerrainDef x) => SketchGenUtility.IsFloorAllowed_NewTmp(x, parms.allowWood ?? true, parms.allowConcrete ?? true, parms.useOnlyStonesAvailableOnMap, parms.onlyBuildableByPlayer ?? false, parms.onlyStoneFloors ?? true);

            if (!BaseGenUtility.TryRandomInexpensiveFloor(out floor1, validator))
            {
                floor2 = null;
                return(false);
            }
            if (parms.singleFloorType ?? false)
            {
                floor2 = null;
                return(true);
            }
            TerrainDef floor1Local = floor1;

            return(BaseGenUtility.TryRandomInexpensiveFloor(out floor2, (TerrainDef x) => x != floor1Local && (validator == null || validator(x))));
        }
Example #3
0
        protected override void ResolveInt(ResolveParams parms)
        {
            CellRect          outerRect = parms.rect ?? parms.sketch.OccupiedRect;
            HashSet <IntVec3> processed = new HashSet <IntVec3>();

            foreach (IntVec3 c in outerRect.Cells.InRandomOrder())
            {
                CellRect cellRect = SketchGenUtility.FindBiggestRectAt(c, outerRect, parms.sketch, processed, (IntVec3 x) => !parms.sketch.ThingsAt(x).Any() && parms.sketch.AnyTerrainAt(c));
                if (cellRect.Width >= 7 && cellRect.Height >= 7)
                {
                    int           newX   = Rand.RangeInclusive(5, cellRect.Width - 2);
                    int           newZ   = Rand.RangeInclusive(5, cellRect.Height - 2);
                    Sketch        sketch = new Sketch();
                    ResolveParams parms2 = parms;
                    parms2.sketch       = sketch;
                    parms2.monumentSize = new IntVec2(newX, newZ);
                    parms2.rect         = null;
                    SketchResolverDefOf.Monument.Resolve(parms2);
                    parms.sketch.MergeAt(sketch, cellRect.CenterCell, Sketch.SpawnPosType.OccupiedCenter, wipeIfCollides: false);
                }
            }
        }
        protected override void ResolveInt(ResolveParams parms)
        {
            CellRect outerRect    = parms.rect ?? parms.sketch.OccupiedRect;
            bool     allowWood    = parms.allowWood ?? true;
            ThingDef stuff        = GenStuff.RandomStuffInexpensiveFor(parms.thingCentral, null, (ThingDef x) => SketchGenUtility.IsStuffAllowed(x, allowWood, parms.useOnlyStonesAvailableOnMap, allowFlammableWalls: true, parms.thingCentral));
            bool     requireFloor = parms.requireFloor ?? false;

            processed.Clear();
            try
            {
                foreach (IntVec3 item in outerRect.Cells.InRandomOrder())
                {
                    CellRect cellRect = SketchGenUtility.FindBiggestRectAt(item, outerRect, parms.sketch, processed, (IntVec3 x) => !parms.sketch.ThingsAt(x).Any() && (!requireFloor || (parms.sketch.TerrainAt(x) != null && parms.sketch.TerrainAt(x).layerable)));
                    if (cellRect.Width >= parms.thingCentral.size.x + 2 && cellRect.Height >= parms.thingCentral.size.z + 2 && Rand.Chance(0.4f))
                    {
                        parms.sketch.AddThing(parms.thingCentral, new IntVec3(cellRect.CenterCell.x - parms.thingCentral.size.x / 2, 0, cellRect.CenterCell.z - parms.thingCentral.size.z / 2), Rot4.North, stuff, 1, null, null, wipeIfCollides: false);
                    }
                }
            }
            finally
            {
                processed.Clear();
            }
        }
        protected override void ResolveInt(ResolveParams parms)
        {
            IntVec2 intVec;

            if (parms.monumentSize.HasValue)
            {
                intVec = parms.monumentSize.Value;
            }
            else
            {
                int num = Rand.Range(10, 50);
                intVec = new IntVec2(num, num);
            }
            int            width    = intVec.x;
            int            height   = intVec.z;
            bool           flag     = ((!parms.monumentOpen.HasValue) ? Rand.Chance(OpenChancePerSizeCurve.Evaluate(Mathf.Max(width, height))) : parms.monumentOpen.Value);
            Sketch         monument = new Sketch();
            bool           onlyBuildableByPlayer = parms.onlyBuildableByPlayer ?? false;
            bool           filterAllowsAll       = parms.allowedMonumentThings == null;
            List <IntVec3> list = new List <IntVec3>();
            bool           horizontalSymmetry;
            bool           verticalSymmetry;

            if (flag)
            {
                horizontalSymmetry = true;
                verticalSymmetry   = true;
                bool[,] array      = AbstractShapeGenerator.Generate(width, height, horizontalSymmetry, verticalSymmetry, allTruesMustBeConnected: false, allowEnclosedFalses: false, preferOutlines: true);
                for (int i = 0; i < array.GetLength(0); i++)
                {
                    for (int j = 0; j < array.GetLength(1); j++)
                    {
                        if (array[i, j])
                        {
                            monument.AddThing(ThingDefOf.Wall, new IntVec3(i, 0, j), Rot4.North, ThingDefOf.WoodLog);
                        }
                    }
                }
            }
            else
            {
                horizontalSymmetry = Rand.Bool;
                verticalSymmetry   = !horizontalSymmetry || Rand.Bool;
                bool[,] shape      = AbstractShapeGenerator.Generate(width - 2, height - 2, horizontalSymmetry, verticalSymmetry, allTruesMustBeConnected: true);
                Func <int, int, bool> func = (int x, int z) => x >= 0 && z >= 0 && x < shape.GetLength(0) && z < shape.GetLength(1) && shape[x, z];
                for (int k = -1; k < shape.GetLength(0) + 1; k++)
                {
                    for (int l = -1; l < shape.GetLength(1) + 1; l++)
                    {
                        if (!func(k, l) && (func(k - 1, l) || func(k, l - 1) || func(k, l + 1) || func(k + 1, l) || func(k - 1, l - 1) || func(k - 1, l + 1) || func(k + 1, l - 1) || func(k + 1, l + 1)))
                        {
                            int newX = k + 1;
                            int newZ = l + 1;
                            monument.AddThing(ThingDefOf.Wall, new IntVec3(newX, 0, newZ), Rot4.North, ThingDefOf.WoodLog);
                        }
                    }
                }
                for (int m = -1; m < shape.GetLength(0) + 1; m++)
                {
                    for (int n = -1; n < shape.GetLength(1) + 1; n++)
                    {
                        if (!func(m, n) && (func(m - 1, n) || func(m, n - 1) || func(m, n + 1) || func(m + 1, n)))
                        {
                            int num2 = m + 1;
                            int num3 = n + 1;
                            if ((!func(m - 1, n) && monument.Passable(new IntVec3(num2 - 1, 0, num3))) || (!func(m, n - 1) && monument.Passable(new IntVec3(num2, 0, num3 - 1))) || (!func(m, n + 1) && monument.Passable(new IntVec3(num2, 0, num3 + 1))) || (!func(m + 1, n) && monument.Passable(new IntVec3(num2 + 1, 0, num3))))
                            {
                                list.Add(new IntVec3(num2, 0, num3));
                            }
                        }
                    }
                }
            }
            ResolveParams parms2 = parms;

            parms2.sketch = monument;
            parms2.connectedGroupsSameStuff = true;
            parms2.assignRandomStuffTo      = ThingDefOf.Wall;
            SketchResolverDefOf.AssignRandomStuff.Resolve(parms2);
            if (parms.addFloors ?? true)
            {
                ResolveParams parms3 = parms;
                parms3.singleFloorType    = true;
                parms3.sketch             = monument;
                parms3.floorFillRoomsOnly = !flag;
                parms3.onlyStoneFloors    = parms.onlyStoneFloors ?? true;
                parms3.allowConcrete      = parms.allowConcrete ?? false;
                parms3.rect = new CellRect(0, 0, width, height);
                SketchResolverDefOf.FloorFill.Resolve(parms3);
            }
            if (CanUse(ThingDefOf.Column))
            {
                ResolveParams parms4 = parms;
                parms4.rect         = new CellRect(0, 0, width, height);
                parms4.sketch       = monument;
                parms4.requireFloor = true;
                SketchResolverDefOf.AddColumns.Resolve(parms4);
            }
            TryPlaceFurniture(parms, monument, CanUse);
            for (int num4 = 0; num4 < 2; num4++)
            {
                ResolveParams parms5 = parms;
                parms5.addFloors = false;
                parms5.sketch    = monument;
                parms5.rect      = new CellRect(0, 0, width, height);
                SketchResolverDefOf.AddInnerMonuments.Resolve(parms5);
            }
            bool num5 = parms.allowMonumentDoors ?? (filterAllowsAll || parms.allowedMonumentThings.Allows(ThingDefOf.Door));

            if (num5 && list.Where((IntVec3 x) => (!horizontalSymmetry || x.x < width / 2) && (!verticalSymmetry || x.z < height / 2) && monument.ThingsAt(x).Any((SketchThing y) => y.def == ThingDefOf.Wall) && ((!monument.ThingsAt(new IntVec3(x.x - 1, x.y, x.z)).Any() && !monument.ThingsAt(new IntVec3(x.x + 1, x.y, x.z)).Any()) || (!monument.ThingsAt(new IntVec3(x.x, x.y, x.z - 1)).Any() && !monument.ThingsAt(new IntVec3(x.x, x.y, x.z + 1)).Any()))).TryRandomElement(out var result))
            {
                SketchThing sketchThing = monument.ThingsAt(result).FirstOrDefault((SketchThing x) => x.def == ThingDefOf.Wall);
                if (sketchThing != null)
                {
                    monument.Remove(sketchThing);
                    monument.AddThing(ThingDefOf.Door, result, Rot4.North, sketchThing.Stuff);
                }
            }
            TryPlaceFurniture(parms, monument, CanUse);
            ApplySymmetry(parms, horizontalSymmetry, verticalSymmetry, monument, width, height);
            if (num5 && !flag && !monument.Things.Any((SketchThing x) => x.def == ThingDefOf.Door) && monument.Things.Where((SketchThing x) => x.def == ThingDefOf.Wall && ((monument.Passable(x.pos.x - 1, x.pos.z) && monument.Passable(x.pos.x + 1, x.pos.z) && monument.AnyTerrainAt(x.pos.x - 1, x.pos.z) != monument.AnyTerrainAt(x.pos.x + 1, x.pos.z)) || (monument.Passable(x.pos.x, x.pos.z - 1) && monument.Passable(x.pos.x, x.pos.z + 1) && monument.AnyTerrainAt(x.pos.x, x.pos.z - 1) != monument.AnyTerrainAt(x.pos.x, x.pos.z + 1)))).TryRandomElement(out var result2))
            {
                SketchThing sketchThing2 = monument.ThingsAt(result2.pos).FirstOrDefault((SketchThing x) => x.def == ThingDefOf.Wall);
                if (sketchThing2 != null)
                {
                    monument.Remove(sketchThing2);
                }
                monument.AddThing(ThingDefOf.Door, result2.pos, Rot4.North, result2.Stuff);
            }
            List <SketchThing> things = monument.Things;

            for (int num6 = 0; num6 < things.Count; num6++)
            {
                if (things[num6].def == ThingDefOf.Wall)
                {
                    monument.RemoveTerrain(things[num6].pos);
                }
            }
            parms.sketch.MergeAt(monument, default(IntVec3), Sketch.SpawnPosType.OccupiedCenter);
            bool CanUse(ThingDef def)
            {
                if (onlyBuildableByPlayer && !SketchGenUtility.PlayerCanBuildNow(def))
                {
                    return(false);
                }
                if (!filterAllowsAll && !parms.allowedMonumentThings.Allows(def))
                {
                    return(false);
                }
                return(true);
            }
        }
Example #6
0
        protected override void ResolveInt(ResolveParams parms)
        {
            CellRect outerRect = parms.rect ?? parms.sketch.OccupiedRect;
            bool     allowWood = parms.allowWood ?? true;
            bool     flag      = parms.requireFloor ?? false;

            rects.Clear();
            processed.Clear();
            foreach (IntVec3 item2 in outerRect.Cells.InRandomOrder())
            {
                CellRect item = SketchGenUtility.FindBiggestRectAt(item2, outerRect, parms.sketch, processed, (IntVec3 x) => !AnyColumnBlockerAt(x, parms.sketch));
                if (!item.IsEmpty)
                {
                    rects.Add(item);
                }
            }
            ThingDef stuff = GenStuff.RandomStuffInexpensiveFor(ThingDefOf.Column, null, (ThingDef x) => SketchGenUtility.IsStuffAllowed(x, allowWood, parms.useOnlyStonesAvailableOnMap, allowFlammableWalls: true, ThingDefOf.Column));

            for (int i = 0; i < rects.Count; i++)
            {
                if (rects[i].Width < 3 || rects[i].Height < 3 || !Rand.Chance(0.8f))
                {
                    continue;
                }
                CellRect cellRect = rects[i].ContractedBy(1);
                Sketch   sketch   = new Sketch();
                if (Rand.Bool)
                {
                    int newZ = Rand.RangeInclusive(cellRect.minZ, cellRect.CenterCell.z);
                    int num  = ((cellRect.Width >= 4) ? Rand.Element(2, 3) : 2);
                    for (int j = cellRect.minX; j <= cellRect.maxX; j += num)
                    {
                        if (!flag || parms.sketch.AnyTerrainAt(new IntVec3(j, 0, newZ)))
                        {
                            sketch.AddThing(ThingDefOf.Column, new IntVec3(j, 0, newZ), Rot4.North, stuff);
                        }
                    }
                    ResolveParams parms2 = parms;
                    parms2.sketch                 = sketch;
                    parms2.symmetryOrigin         = rects[i].minZ + rects[i].Height / 2;
                    parms2.symmetryOriginIncluded = rects[i].Height % 2 == 1;
                    SketchResolverDefOf.Symmetry.Resolve(parms2);
                }
                else
                {
                    int newX = Rand.RangeInclusive(cellRect.minX, cellRect.CenterCell.x);
                    int num2 = ((cellRect.Height >= 4) ? Rand.Element(2, 3) : 2);
                    for (int k = cellRect.minZ; k <= cellRect.maxZ; k += num2)
                    {
                        if (!flag || parms.sketch.AnyTerrainAt(new IntVec3(newX, 0, k)))
                        {
                            sketch.AddThing(ThingDefOf.Column, new IntVec3(newX, 0, k), Rot4.North, stuff);
                        }
                    }
                    ResolveParams parms3 = parms;
                    parms3.sketch                 = sketch;
                    parms3.symmetryOrigin         = rects[i].minX + rects[i].Width / 2;
                    parms3.symmetryOriginIncluded = rects[i].Width % 2 == 1;
                    SketchResolverDefOf.Symmetry.Resolve(parms3);
                }
                parms.sketch.Merge(sketch, wipeIfCollides: false);
            }
            rects.Clear();
            processed.Clear();
        }
        protected override void ResolveInt(ResolveParams parms)
        {
            ThingDef assignRandomStuffTo = parms.assignRandomStuffTo;
            bool     flag                = parms.connectedGroupsSameStuff ?? false;
            bool     allowWood           = parms.allowWood ?? true;
            bool     allowFlammableWalls = parms.allowFlammableWalls ?? true;

            thingsAt.Clear();
            foreach (SketchThing thing2 in parms.sketch.Things)
            {
                if (assignRandomStuffTo != null && thing2.def != assignRandomStuffTo)
                {
                    continue;
                }
                foreach (IntVec3 item in thing2.OccupiedRect)
                {
                    if (!thingsAt.TryGetValue(item, out var value))
                    {
                        value = new List <SketchThing>();
                        thingsAt.Add(item, value);
                    }
                    value.Add(thing2);
                }
            }
            visited.Clear();
            foreach (SketchThing thing in parms.sketch.Things)
            {
                if ((assignRandomStuffTo != null && thing.def != assignRandomStuffTo) || visited.Contains(thing))
                {
                    continue;
                }
                ThingDef stuff = GenStuff.RandomStuffInexpensiveFor(thing.def, null, (ThingDef x) => SketchGenUtility.IsStuffAllowed(x, allowWood, parms.useOnlyStonesAvailableOnMap, allowFlammableWalls, thing.def));
                thing.stuff = stuff;
                visited.Add(thing);
                if (!flag)
                {
                    continue;
                }
                stack.Clear();
                stack.Push(thing);
                while (stack.Count != 0)
                {
                    SketchThing sketchThing = stack.Pop();
                    sketchThing.stuff = stuff;
                    foreach (IntVec3 item2 in sketchThing.OccupiedRect.ExpandedBy(1))
                    {
                        if (!thingsAt.TryGetValue(item2, out var value2))
                        {
                            continue;
                        }
                        for (int i = 0; i < value2.Count; i++)
                        {
                            if (value2[i].def == thing.def && !visited.Contains(value2[i]))
                            {
                                visited.Add(value2[i]);
                                stack.Push(value2[i]);
                            }
                        }
                    }
                }
            }
        }
        protected override void ResolveInt(ResolveParams parms)
        {
            wallPositions.Clear();
            for (int i = 0; i < parms.sketch.Things.Count; i++)
            {
                if (parms.sketch.Things[i].def == ThingDefOf.Wall)
                {
                    wallPositions.Add(parms.sketch.Things[i].pos);
                }
            }
            bool     allowWood = parms.allowWood ?? true;
            ThingDef stuff     = GenStuff.RandomStuffInexpensiveFor(parms.cornerThing, null, (ThingDef x) => SketchGenUtility.IsStuffAllowed(x, allowWood, parms.useOnlyStonesAvailableOnMap, allowFlammableWalls: true, parms.cornerThing));
            bool     flag      = parms.requireFloor ?? false;

            try
            {
                foreach (IntVec3 wallPosition in wallPositions)
                {
                    if (Rand.Chance(0.09f))
                    {
                        if (wallPositions.Contains(new IntVec3(wallPosition.x + 1, 0, wallPosition.z - 1)) && !wallPositions.Contains(new IntVec3(wallPosition.x + 1, 0, wallPosition.z)) && (!flag || (parms.sketch.TerrainAt(new IntVec3(wallPosition.x + 1, 0, wallPosition.z)) != null && parms.sketch.TerrainAt(new IntVec3(wallPosition.x + 1, 0, wallPosition.z)).layerable)))
                        {
                            parms.sketch.AddThing(parms.cornerThing, new IntVec3(wallPosition.x + 1, 0, wallPosition.z), Rot4.North, stuff, 1, null, null, wipeIfCollides: false);
                        }
                        if (wallPositions.Contains(new IntVec3(wallPosition.x + 1, 0, wallPosition.z - 1)) && !wallPositions.Contains(new IntVec3(wallPosition.x, 0, wallPosition.z - 1)) && (!flag || (parms.sketch.TerrainAt(new IntVec3(wallPosition.x, 0, wallPosition.z - 1)) != null && parms.sketch.TerrainAt(new IntVec3(wallPosition.x, 0, wallPosition.z - 1)).layerable)))
                        {
                            parms.sketch.AddThing(parms.cornerThing, new IntVec3(wallPosition.x, 0, wallPosition.z - 1), Rot4.North, stuff, 1, null, null, wipeIfCollides: false);
                        }
                        if (wallPositions.Contains(new IntVec3(wallPosition.x + 1, 0, wallPosition.z + 1)) && !wallPositions.Contains(new IntVec3(wallPosition.x, 0, wallPosition.z + 1)) && (!flag || (parms.sketch.TerrainAt(new IntVec3(wallPosition.x, 0, wallPosition.z + 1)) != null && parms.sketch.TerrainAt(new IntVec3(wallPosition.x, 0, wallPosition.z + 1)).layerable)))
                        {
                            parms.sketch.AddThing(parms.cornerThing, new IntVec3(wallPosition.x, 0, wallPosition.z + 1), Rot4.North, stuff, 1, null, null, wipeIfCollides: false);
                        }
                        if (wallPositions.Contains(new IntVec3(wallPosition.x + 1, 0, wallPosition.z + 1)) && !wallPositions.Contains(new IntVec3(wallPosition.x + 1, 0, wallPosition.z)) && (!flag || (parms.sketch.TerrainAt(new IntVec3(wallPosition.x + 1, 0, wallPosition.z)) != null && parms.sketch.TerrainAt(new IntVec3(wallPosition.x + 1, 0, wallPosition.z)).layerable)))
                        {
                            parms.sketch.AddThing(parms.cornerThing, new IntVec3(wallPosition.x + 1, 0, wallPosition.z), Rot4.North, stuff, 1, null, null, wipeIfCollides: false);
                        }
                    }
                }
            }
            finally
            {
                wallPositions.Clear();
            }
        }