Esempio n. 1
0
        public static void Dilate(List <IntVec3> cells, int count, Map map, Predicate <IntVec3> extraPredicate = null)
        {
            if (count <= 0)
            {
                return;
            }
            FloodFiller         arg_73_0 = map.floodFiller;
            IntVec3             invalid  = IntVec3.Invalid;
            Predicate <IntVec3> arg_52_0 = extraPredicate;

            if (extraPredicate == null)
            {
                arg_52_0 = ((IntVec3 x) => true);
            }
            Predicate <IntVec3>       passCheck = arg_52_0;
            Func <IntVec3, int, bool> processor = delegate(IntVec3 cell, int traversalDist)
            {
                if (traversalDist > count)
                {
                    return(true);
                }
                if (traversalDist != 0)
                {
                    cells.Add(cell);
                }
                return(false);
            };
            List <IntVec3> cells2 = cells;

            arg_73_0.FloodFill(invalid, passCheck, processor, 2147483647, false, cells2);
        }
Esempio n. 2
0
        public static void Dilate(List <IntVec3> cells, int count, Map map, Predicate <IntVec3> extraPredicate = null)
        {
            if (count <= 0)
            {
                return;
            }
            FloodFiller         floodFiller = map.floodFiller;
            IntVec3             invalid     = IntVec3.Invalid;
            Predicate <IntVec3> predicate   = extraPredicate;

            if (extraPredicate == null)
            {
                predicate = ((IntVec3 x) => true);
            }
            Predicate <IntVec3>       passCheck = predicate;
            Func <IntVec3, int, bool> processor = delegate(IntVec3 cell, int traversalDist)
            {
                if (traversalDist > count)
                {
                    return(true);
                }
                if (traversalDist != 0)
                {
                    cells.Add(cell);
                }
                return(false);
            };
            List <IntVec3> cells2 = cells;

            floodFiller.FloodFill(invalid, passCheck, processor, int.MaxValue, false, cells2);
        }
Esempio n. 3
0
        public static void Erode(List <IntVec3> cells, int count, Map map, Predicate <IntVec3> extraPredicate = null)
        {
            if (count <= 0)
            {
                return;
            }
            IntVec3[] cardinalDirections = GenAdj.CardinalDirections;
            GenMorphology.cellsSet.Clear();
            GenMorphology.cellsSet.AddRange(cells);
            GenMorphology.tmpEdgeCells.Clear();
            for (int i = 0; i < cells.Count; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    IntVec3 item = cells[i] + cardinalDirections[j];
                    if (!GenMorphology.cellsSet.Contains(item))
                    {
                        GenMorphology.tmpEdgeCells.Add(cells[i]);
                        break;
                    }
                }
            }
            if (!GenMorphology.tmpEdgeCells.Any <IntVec3>())
            {
                return;
            }
            GenMorphology.tmpOutput.Clear();
            Predicate <IntVec3> predicate;

            if (extraPredicate != null)
            {
                predicate = ((IntVec3 x) => GenMorphology.cellsSet.Contains(x) && extraPredicate(x));
            }
            else
            {
                predicate = ((IntVec3 x) => GenMorphology.cellsSet.Contains(x));
            }
            FloodFiller               arg_13B_0 = map.floodFiller;
            IntVec3                   invalid   = IntVec3.Invalid;
            Predicate <IntVec3>       passCheck = predicate;
            Func <IntVec3, int, bool> processor = delegate(IntVec3 cell, int traversalDist)
            {
                if (traversalDist >= count)
                {
                    GenMorphology.tmpOutput.Add(cell);
                }
                return(false);
            };
            List <IntVec3> extraRoots = GenMorphology.tmpEdgeCells;

            arg_13B_0.FloodFill(invalid, passCheck, processor, 2147483647, false, extraRoots);
            cells.Clear();
            cells.AddRange(GenMorphology.tmpOutput);
        }
Esempio n. 4
0
 public static void Erode(List <IntVec3> cells, int count, Map map, Predicate <IntVec3> extraPredicate = null)
 {
     if (count > 0)
     {
         IntVec3[] cardinalDirections = GenAdj.CardinalDirections;
         cellsSet.Clear();
         cellsSet.AddRange(cells);
         tmpEdgeCells.Clear();
         for (int i = 0; i < cells.Count; i++)
         {
             for (int j = 0; j < 4; j++)
             {
                 IntVec3 item = cells[i] + cardinalDirections[j];
                 if (!cellsSet.Contains(item))
                 {
                     tmpEdgeCells.Add(cells[i]);
                     break;
                 }
             }
         }
         if (tmpEdgeCells.Any())
         {
             tmpOutput.Clear();
             Predicate <IntVec3>       predicate   = (extraPredicate == null) ? ((Predicate <IntVec3>)((IntVec3 x) => cellsSet.Contains(x))) : ((Predicate <IntVec3>)((IntVec3 x) => cellsSet.Contains(x) && extraPredicate(x)));
             FloodFiller               floodFiller = map.floodFiller;
             IntVec3                   invalid     = IntVec3.Invalid;
             Predicate <IntVec3>       passCheck   = predicate;
             Func <IntVec3, int, bool> processor   = delegate(IntVec3 cell, int traversalDist)
             {
                 if (traversalDist >= count)
                 {
                     tmpOutput.Add(cell);
                 }
                 return(false);
             };
             List <IntVec3> extraRoots = tmpEdgeCells;
             floodFiller.FloodFill(invalid, passCheck, processor, 2147483647, rememberParents: false, extraRoots);
             cells.Clear();
             cells.AddRange(tmpOutput);
         }
     }
 }
Esempio n. 5
0
 public static void Dilate(List <IntVec3> cells, int count, Map map, Predicate <IntVec3> extraPredicate = null)
 {
     if (count > 0)
     {
         FloodFiller               floodFiller = map.floodFiller;
         IntVec3                   invalid     = IntVec3.Invalid;
         Predicate <IntVec3>       passCheck   = extraPredicate ?? ((Predicate <IntVec3>)((IntVec3 x) => true));
         Func <IntVec3, int, bool> processor   = delegate(IntVec3 cell, int traversalDist)
         {
             if (traversalDist > count)
             {
                 return(true);
             }
             if (traversalDist != 0)
             {
                 cells.Add(cell);
             }
             return(false);
         };
         List <IntVec3> extraRoots = cells;
         floodFiller.FloodFill(invalid, passCheck, processor, 2147483647, rememberParents: false, extraRoots);
     }
 }
Esempio n. 6
0
 public void ConstructComponents()
 {
     this.spawnedThings      = new ThingOwner <Thing>(this);
     this.cellIndices        = new CellIndices(this);
     this.listerThings       = new ListerThings(ListerThingsUse.Global);
     this.listerBuildings    = new ListerBuildings();
     this.mapPawns           = new MapPawns(this);
     this.dynamicDrawManager = new DynamicDrawManager(this);
     this.mapDrawer          = new MapDrawer(this);
     this.tooltipGiverList   = new TooltipGiverList();
     this.pawnDestinationReservationManager = new PawnDestinationReservationManager();
     this.reservationManager = new ReservationManager(this);
     this.physicalInteractionReservationManager = new PhysicalInteractionReservationManager();
     this.designationManager             = new DesignationManager(this);
     this.lordManager                    = new LordManager(this);
     this.debugDrawer                    = new DebugCellDrawer();
     this.passingShipManager             = new PassingShipManager(this);
     this.haulDestinationManager         = new HaulDestinationManager(this);
     this.gameConditionManager           = new GameConditionManager(this);
     this.weatherManager                 = new WeatherManager(this);
     this.zoneManager                    = new ZoneManager(this);
     this.resourceCounter                = new ResourceCounter(this);
     this.mapTemperature                 = new MapTemperature(this);
     this.temperatureCache               = new TemperatureCache(this);
     this.areaManager                    = new AreaManager(this);
     this.attackTargetsCache             = new AttackTargetsCache(this);
     this.attackTargetReservationManager = new AttackTargetReservationManager(this);
     this.lordsStarter                   = new VoluntarilyJoinableLordsStarter(this);
     this.thingGrid                  = new ThingGrid(this);
     this.coverGrid                  = new CoverGrid(this);
     this.edificeGrid                = new EdificeGrid(this);
     this.blueprintGrid              = new BlueprintGrid(this);
     this.fogGrid                    = new FogGrid(this);
     this.glowGrid                   = new GlowGrid(this);
     this.regionGrid                 = new RegionGrid(this);
     this.terrainGrid                = new TerrainGrid(this);
     this.pathGrid                   = new PathGrid(this);
     this.roofGrid                   = new RoofGrid(this);
     this.fertilityGrid              = new FertilityGrid(this);
     this.snowGrid                   = new SnowGrid(this);
     this.deepResourceGrid           = new DeepResourceGrid(this);
     this.exitMapGrid                = new ExitMapGrid(this);
     this.linkGrid                   = new LinkGrid(this);
     this.glowFlooder                = new GlowFlooder(this);
     this.powerNetManager            = new PowerNetManager(this);
     this.powerNetGrid               = new PowerNetGrid(this);
     this.regionMaker                = new RegionMaker(this);
     this.pathFinder                 = new PathFinder(this);
     this.pawnPathPool               = new PawnPathPool(this);
     this.regionAndRoomUpdater       = new RegionAndRoomUpdater(this);
     this.regionLinkDatabase         = new RegionLinkDatabase();
     this.moteCounter                = new MoteCounter();
     this.gatherSpotLister           = new GatherSpotLister();
     this.windManager                = new WindManager(this);
     this.listerBuildingsRepairable  = new ListerBuildingsRepairable();
     this.listerHaulables            = new ListerHaulables(this);
     this.listerMergeables           = new ListerMergeables(this);
     this.listerFilthInHomeArea      = new ListerFilthInHomeArea(this);
     this.reachability               = new Reachability(this);
     this.itemAvailability           = new ItemAvailability(this);
     this.autoBuildRoofAreaSetter    = new AutoBuildRoofAreaSetter(this);
     this.roofCollapseBufferResolver = new RoofCollapseBufferResolver(this);
     this.roofCollapseBuffer         = new RoofCollapseBuffer();
     this.wildAnimalSpawner          = new WildAnimalSpawner(this);
     this.wildPlantSpawner           = new WildPlantSpawner(this);
     this.steadyEnvironmentEffects   = new SteadyEnvironmentEffects(this);
     this.skyManager                 = new SkyManager(this);
     this.overlayDrawer              = new OverlayDrawer();
     this.floodFiller                = new FloodFiller(this);
     this.weatherDecider             = new WeatherDecider(this);
     this.fireWatcher                = new FireWatcher(this);
     this.dangerWatcher              = new DangerWatcher(this);
     this.damageWatcher              = new DamageWatcher();
     this.strengthWatcher            = new StrengthWatcher(this);
     this.wealthWatcher              = new WealthWatcher(this);
     this.regionDirtyer              = new RegionDirtyer(this);
     this.cellsInRandomOrder         = new MapCellsInRandomOrder(this);
     this.rememberedCameraPos        = new RememberedCameraPos(this);
     this.mineStrikeManager          = new MineStrikeManager();
     this.storyState                 = new StoryState(this);
     this.retainedCaravanData        = new RetainedCaravanData(this);
     this.components.Clear();
     this.FillComponents();
 }