private void MergeRandomChildren()
        {
            if (this.children.Count < 4)
            {
                return;
            }
            int num = GenMath.RoundRandom((float)this.children.Count / 6f);

            for (int i = 0; i < num; i++)
            {
                SymbolResolver_BasePart_Outdoors_Division_Grid.Child child = this.children.Find((SymbolResolver_BasePart_Outdoors_Division_Grid.Child x) => !x.merged);
                if (child == null)
                {
                    break;
                }
                SymbolResolver_BasePart_Outdoors_Division_Grid.Child child3 = this.children.Find((SymbolResolver_BasePart_Outdoors_Division_Grid.Child x) => x != child && ((Mathf.Abs(x.gridX - child.gridX) == 1 && x.gridY == child.gridY) || (Mathf.Abs(x.gridY - child.gridY) == 1 && x.gridX == child.gridX)));
                if (child3 != null)
                {
                    this.children.Remove(child);
                    this.children.Remove(child3);
                    SymbolResolver_BasePart_Outdoors_Division_Grid.Child child2 = new SymbolResolver_BasePart_Outdoors_Division_Grid.Child();
                    child2.gridX  = Mathf.Min(child.gridX, child3.gridX);
                    child2.gridY  = Mathf.Min(child.gridY, child3.gridY);
                    child2.merged = true;
                    child2.rect   = CellRect.FromLimits(Mathf.Min(child.rect.minX, child3.rect.minX), Mathf.Min(child.rect.minZ, child3.rect.minZ), Mathf.Max(child.rect.maxX, child3.rect.maxX), Mathf.Max(child.rect.maxZ, child3.rect.maxZ));
                    this.children.Add(child2);
                }
            }
        }
        private void ResolveOption(int roomsPerRowX, int pathwayWidthX, int roomsPerRowZ, int pathwayWidthZ, ResolveParams rp)
        {
            Map      map       = BaseGen.globalSettings.map;
            int      roomSize  = this.GetRoomSize(roomsPerRowX, pathwayWidthX, rp.rect.Width);
            int      roomSize2 = this.GetRoomSize(roomsPerRowZ, pathwayWidthZ, rp.rect.Height);
            ThingDef thingDef  = null;

            if (pathwayWidthX >= 3)
            {
                if (rp.faction == null || rp.faction.def.techLevel >= TechLevel.Industrial)
                {
                    thingDef = ThingDefOf.StandingLamp;
                }
                else
                {
                    thingDef = ThingDefOf.TorchLamp;
                }
            }
            TerrainDef floorDef = rp.pathwayFloorDef ?? BaseGenUtility.RandomBasicFloorDef(rp.faction, false);
            int        num      = roomSize;

            for (int i = 0; i < roomsPerRowX - 1; i++)
            {
                CellRect      rect          = new CellRect(rp.rect.minX + num, rp.rect.minZ, pathwayWidthX, rp.rect.Height);
                ResolveParams resolveParams = rp;
                resolveParams.rect             = rect;
                resolveParams.floorDef         = floorDef;
                resolveParams.streetHorizontal = new bool?(false);
                BaseGen.symbolStack.Push("street", resolveParams);
                num += roomSize + pathwayWidthX;
            }
            int num2 = roomSize2;

            for (int j = 0; j < roomsPerRowZ - 1; j++)
            {
                CellRect      rect2          = new CellRect(rp.rect.minX, rp.rect.minZ + num2, rp.rect.Width, pathwayWidthZ);
                ResolveParams resolveParams2 = rp;
                resolveParams2.rect             = rect2;
                resolveParams2.floorDef         = floorDef;
                resolveParams2.streetHorizontal = new bool?(true);
                BaseGen.symbolStack.Push("street", resolveParams2);
                num2 += roomSize2 + pathwayWidthZ;
            }
            num  = 0;
            num2 = 0;
            this.children.Clear();
            for (int k = 0; k < roomsPerRowX; k++)
            {
                for (int l = 0; l < roomsPerRowZ; l++)
                {
                    SymbolResolver_BasePart_Outdoors_Division_Grid.Child child = new SymbolResolver_BasePart_Outdoors_Division_Grid.Child();
                    child.rect  = new CellRect(rp.rect.minX + num, rp.rect.minZ + num2, roomSize, roomSize2);
                    child.gridX = k;
                    child.gridY = l;
                    this.children.Add(child);
                    num2 += roomSize2 + pathwayWidthZ;
                }
                num += roomSize + pathwayWidthX;
                num2 = 0;
            }
            this.MergeRandomChildren();
            this.children.Shuffle <SymbolResolver_BasePart_Outdoors_Division_Grid.Child>();
            for (int m = 0; m < this.children.Count; m++)
            {
                if (thingDef != null)
                {
                    IntVec3 c = new IntVec3(this.children[m].rect.maxX + 1, 0, this.children[m].rect.maxZ);
                    if (rp.rect.Contains(c) && c.Standable(map))
                    {
                        ResolveParams resolveParams3 = rp;
                        resolveParams3.rect           = CellRect.SingleCell(c);
                        resolveParams3.singleThingDef = thingDef;
                        BaseGen.symbolStack.Push("thing", resolveParams3);
                    }
                }
                ResolveParams resolveParams4 = rp;
                resolveParams4.rect = this.children[m].rect;
                BaseGen.symbolStack.Push("basePart_outdoors", resolveParams4);
            }
        }
 private static bool <MergeRandomChildren> m__2(SymbolResolver_BasePart_Outdoors_Division_Grid.Child x)
 {
     return(!x.merged);
 }