private static bool CheckCollapseFlyingRoofAtAndAdjInternal(IntVec3 root, Map map, bool removalMode, bool canRemoveThickRoof)
        {
            RoofCollapseBuffer roofCollapseBuffer = map.roofCollapseBuffer;

            if (removalMode && roofCollapseBuffer.CellsMarkedToCollapse.Count > 0)
            {
                map.roofCollapseBufferResolver.CollapseRoofsMarkedToCollapse();
            }
            for (int i = 0; i < 5; i++)
            {
                IntVec3 intVec = root + GenAdj.CardinalDirectionsAndInside[i];
                if (intVec.InBounds(map) && intVec.Roofed(map) && !visitedCells.Contains(intVec) && !roofCollapseBuffer.IsMarkedToCollapse(intVec) && !ConnectsToRoofHolder(intVec, map, visitedCells))
                {
                    map.floodFiller.FloodFill(intVec, (IntVec3 x) => x.Roofed(map), delegate(IntVec3 x)
                    {
                        roofCollapseBuffer.MarkToCollapse(x);
                    });
                    if (removalMode)
                    {
                        List <IntVec3> cellsMarkedToCollapse = roofCollapseBuffer.CellsMarkedToCollapse;
                        for (int num = cellsMarkedToCollapse.Count - 1; num >= 0; num--)
                        {
                            RoofDef roofDef = map.roofGrid.RoofAt(cellsMarkedToCollapse[num]);
                            if (roofDef != null && (canRemoveThickRoof || roofDef.VanishOnCollapse))
                            {
                                map.roofGrid.SetRoof(cellsMarkedToCollapse[num], null);
                                cellsMarkedToCollapse.RemoveAt(num);
                            }
                        }
                    }
                }
            }
            return(false);
        }
        private static bool CheckCollapseFlyingRoofAtAndAdjInternal(IntVec3 root, Map map, bool removalMode)
        {
            RoofCollapseBuffer roofCollapseBuffer = map.roofCollapseBuffer;

            if (removalMode && roofCollapseBuffer.CellsMarkedToCollapse.Count > 0)
            {
                map.roofCollapseBufferResolver.CollapseRoofsMarkedToCollapse();
            }
            for (int i = 0; i < 5; i++)
            {
                IntVec3 intVec = root + GenAdj.CardinalDirectionsAndInside[i];
                if (intVec.InBounds(map))
                {
                    if (intVec.Roofed(map))
                    {
                        if (!RoofCollapseCellsFinder.visitedCells.Contains(intVec))
                        {
                            if (!roofCollapseBuffer.IsMarkedToCollapse(intVec))
                            {
                                if (!RoofCollapseCellsFinder.ConnectsToRoofHolder(intVec, map, RoofCollapseCellsFinder.visitedCells))
                                {
                                    map.floodFiller.FloodFill(intVec, (IntVec3 x) => x.Roofed(map), delegate(IntVec3 x)
                                    {
                                        roofCollapseBuffer.MarkToCollapse(x);
                                    }, 2147483647, false, null);
                                    if (removalMode)
                                    {
                                        List <IntVec3> cellsMarkedToCollapse = roofCollapseBuffer.CellsMarkedToCollapse;
                                        for (int j = cellsMarkedToCollapse.Count - 1; j >= 0; j--)
                                        {
                                            RoofDef roofDef = map.roofGrid.RoofAt(cellsMarkedToCollapse[j]);
                                            if (roofDef != null && roofDef.VanishOnCollapse)
                                            {
                                                map.roofGrid.SetRoof(cellsMarkedToCollapse[j], null);
                                                cellsMarkedToCollapse.RemoveAt(j);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(false);
        }