示例#1
0
 public void FinalizeInit()
 {
     this.pathGrid.RecalculateAllPerceivedPathCosts();
     this.regionAndRoomUpdater.Enabled = true;
     this.regionAndRoomUpdater.RebuildAllRegionsAndRooms();
     this.powerNetManager.UpdatePowerNetsAndConnections_First();
     this.temperatureCache.temperatureSaveLoad.ApplyLoadedDataToRegions();
     foreach (Thing thing in this.listerThings.AllThings.ToList <Thing>())
     {
         try
         {
             thing.PostMapInit();
         }
         catch (Exception ex)
         {
             Log.Error(string.Concat(new object[]
             {
                 "Exception PostMapInit in ",
                 thing,
                 ": ",
                 ex
             }), false);
         }
     }
     this.listerFilthInHomeArea.RebuildAll();
     LongEventHandler.ExecuteWhenFinished(delegate
     {
         this.mapDrawer.RegenerateEverythingNow();
     });
     this.resourceCounter.UpdateResourceCounts();
     this.wealthWatcher.ForceRecount(true);
     MapComponentUtility.FinalizeInit(this);
 }
示例#2
0
        public void MapUpdate()
        {
            bool worldRenderedNow = WorldRendererUtility.WorldRenderedNow;

            this.skyManager.SkyManagerUpdate();
            this.powerNetManager.UpdatePowerNetsAndConnections_First();
            this.regionGrid.UpdateClean();
            this.regionAndRoomUpdater.TryRebuildDirtyRegionsAndRooms();
            this.glowGrid.GlowGridUpdate_First();
            this.lordManager.LordManagerUpdate();
            if (!worldRenderedNow && Find.VisibleMap == this)
            {
                this.waterInfo.SetTextures();
                Find.FactionManager.FactionsDebugDrawOnMap();
                this.mapDrawer.MapMeshDrawerUpdate_First();
                this.powerNetGrid.DrawDebugPowerNetGrid();
                DoorsDebugDrawer.DrawDebug();
                this.mapDrawer.DrawMapMesh();
                this.dynamicDrawManager.DrawDynamicThings();
                this.gameConditionManager.GameConditionManagerDraw();
                MapEdgeClipDrawer.DrawClippers(this);
                this.designationManager.DrawDesignations();
                this.overlayDrawer.DrawAllOverlays();
            }
            try
            {
                this.areaManager.AreaManagerUpdate();
            }
            catch (Exception ex)
            {
                Log.Error(ex.ToString());
            }
            this.weatherManager.WeatherManagerUpdate();
            MapComponentUtility.MapComponentUpdate(this);
        }
示例#3
0
 public void FinalizeInit()
 {
     pathGrid.RecalculateAllPerceivedPathCosts();
     regionAndRoomUpdater.Enabled = true;
     regionAndRoomUpdater.RebuildAllRegionsAndRooms();
     powerNetManager.UpdatePowerNetsAndConnections_First();
     temperatureCache.temperatureSaveLoad.ApplyLoadedDataToRegions();
     avoidGrid.Regenerate();
     foreach (Thing item in listerThings.AllThings.ToList())
     {
         try
         {
             item.PostMapInit();
         }
         catch (Exception ex)
         {
             Log.Error("Error in PostMapInit() for " + item.ToStringSafe() + ": " + ex);
         }
     }
     listerFilthInHomeArea.RebuildAll();
     LongEventHandler.ExecuteWhenFinished(delegate
     {
         mapDrawer.RegenerateEverythingNow();
     });
     resourceCounter.UpdateResourceCounts();
     wealthWatcher.ForceRecount(allowDuringInit: true);
     MapComponentUtility.FinalizeInit(this);
 }
示例#4
0
        public void DeinitAndRemoveMap(Map map)
        {
            if (map == null)
            {
                Log.Error("Tried to remove null map.");
                return;
            }
            if (!maps.Contains(map))
            {
                Log.Error("Tried to remove map " + map + " but it's not here.");
                return;
            }
            if (map.Parent != null)
            {
                map.Parent.Notify_MyMapAboutToBeRemoved();
            }
            Map currentMap = CurrentMap;

            MapDeiniter.Deinit(map);
            maps.Remove(map);
            if (currentMap != null)
            {
                sbyte b = (sbyte)maps.IndexOf(currentMap);
                if (b < 0)
                {
                    if (maps.Any())
                    {
                        CurrentMap = maps[0];
                    }
                    else
                    {
                        CurrentMap = null;
                    }
                    Find.World.renderer.wantedMode = WorldRenderMode.Planet;
                }
                else
                {
                    currentMapIndex = b;
                }
            }
            if (Current.ProgramState == ProgramState.Playing)
            {
                Find.ColonistBar.MarkColonistsDirty();
            }
            MapComponentUtility.MapRemoved(map);
            if (map.Parent != null)
            {
                map.Parent.Notify_MyMapRemoved(map);
            }
        }
示例#5
0
        public void DeinitAndRemoveMap(Map map)
        {
            if (map == null)
            {
                Log.Error("Tried to remove null map.");
                return;
            }
            if (!this.maps.Contains(map))
            {
                Log.Error("Tried to remove map " + map + " but it's not here.");
                return;
            }
            Map visibleMap = this.VisibleMap;

            MapDeiniter.Deinit(map);
            this.maps.Remove(map);
            if (visibleMap != null)
            {
                sbyte b = (sbyte)this.maps.IndexOf(visibleMap);
                if ((int)b < 0)
                {
                    if (this.maps.Any <Map>())
                    {
                        this.VisibleMap = this.maps[0];
                    }
                    else
                    {
                        this.VisibleMap = null;
                    }
                    Find.World.renderer.wantedMode = WorldRenderMode.Planet;
                }
                else
                {
                    this.visibleMapIndex = b;
                }
            }
            if (Current.ProgramState == ProgramState.Playing)
            {
                Find.ColonistBar.MarkColonistsDirty();
            }
            MapComponentUtility.MapRemoved(map);
            if (map.info.parent != null)
            {
                map.info.parent.Notify_MyMapRemoved(map);
            }
        }
示例#6
0
        public void MapUpdate()
        {
            bool worldRenderedNow = WorldRendererUtility.WorldRenderedNow;

            skyManager.SkyManagerUpdate();
            powerNetManager.UpdatePowerNetsAndConnections_First();
            regionGrid.UpdateClean();
            regionAndRoomUpdater.TryRebuildDirtyRegionsAndRooms();
            glowGrid.GlowGridUpdate_First();
            lordManager.LordManagerUpdate();
            if (!worldRenderedNow && Find.CurrentMap == this)
            {
                if (AlwaysRedrawShadows)
                {
                    mapDrawer.WholeMapChanged(MapMeshFlag.Things);
                }
                PlantFallColors.SetFallShaderGlobals(this);
                waterInfo.SetTextures();
                avoidGrid.DebugDrawOnMap();
                mapDrawer.MapMeshDrawerUpdate_First();
                powerNetGrid.DrawDebugPowerNetGrid();
                DoorsDebugDrawer.DrawDebug();
                mapDrawer.DrawMapMesh();
                dynamicDrawManager.DrawDynamicThings();
                gameConditionManager.GameConditionManagerDraw(this);
                MapEdgeClipDrawer.DrawClippers(this);
                designationManager.DrawDesignations();
                overlayDrawer.DrawAllOverlays();
                temporaryThingDrawer.Draw();
            }
            try
            {
                areaManager.AreaManagerUpdate();
            }
            catch (Exception ex)
            {
                Log.Error(ex.ToString());
            }
            weatherManager.WeatherManagerUpdate();
            MapComponentUtility.MapComponentUpdate(this);
        }
示例#7
0
        public void MapUpdate()
        {
            bool worldRenderedNow = WorldRendererUtility.WorldRenderedNow;

            Profiler.BeginSample("SkyManagerUpdate()");
            this.skyManager.SkyManagerUpdate();
            Profiler.EndSample();
            Profiler.BeginSample("PowerNetManager.UpdatePowerNetsAndConnections_First()");
            this.powerNetManager.UpdatePowerNetsAndConnections_First();
            Profiler.EndSample();
            Profiler.BeginSample("regionGrid.UpdateClean()");
            this.regionGrid.UpdateClean();
            Profiler.EndSample();
            Profiler.BeginSample("RegionAndRoomUpdater.TryRebuildDirtyRegionsAndRooms()");
            this.regionAndRoomUpdater.TryRebuildDirtyRegionsAndRooms();
            Profiler.EndSample();
            Profiler.BeginSample("glowGrid.GlowGridUpdate_First()");
            this.glowGrid.GlowGridUpdate_First();
            Profiler.EndSample();
            Profiler.BeginSample("LordManagerUpdate()");
            this.lordManager.LordManagerUpdate();
            Profiler.EndSample();
            if (!worldRenderedNow && Find.CurrentMap == this)
            {
                if (Map.AlwaysRedrawShadows)
                {
                    this.mapDrawer.WholeMapChanged(MapMeshFlag.Things);
                }
                Profiler.BeginSample("FallIntensityUpdate");
                GenPlant.SetFallShaderGlobals(this);
                Profiler.EndSample();
                Profiler.BeginSample("waterInfo.SetTextures()");
                this.waterInfo.SetTextures();
                Profiler.EndSample();
                Profiler.BeginSample("FactionsDebugDrawOnMap()");
                Find.FactionManager.FactionsDebugDrawOnMap();
                Profiler.EndSample();
                Profiler.BeginSample("mapDrawer.MapMeshDrawerUpdate_First");
                this.mapDrawer.MapMeshDrawerUpdate_First();
                Profiler.EndSample();
                Profiler.BeginSample("PowerNetGrid.DrawDebugPowerNetGrid()");
                this.powerNetGrid.DrawDebugPowerNetGrid();
                Profiler.EndSample();
                Profiler.BeginSample("DoorsDebugDrawer.DrawDebug()");
                DoorsDebugDrawer.DrawDebug();
                Profiler.EndSample();
                Profiler.BeginSample("mapDrawer.DrawMapMesh");
                this.mapDrawer.DrawMapMesh();
                Profiler.EndSample();
                Profiler.BeginSample("drawManager.DrawDynamicThings");
                this.dynamicDrawManager.DrawDynamicThings();
                Profiler.EndSample();
                Profiler.BeginSample("GameConditionManagerDraw");
                this.gameConditionManager.GameConditionManagerDraw(this);
                Profiler.EndSample();
                Profiler.BeginSample("DrawClippers");
                MapEdgeClipDrawer.DrawClippers(this);
                Profiler.EndSample();
                Profiler.BeginSample("designationManager.DrawDesignations()");
                this.designationManager.DrawDesignations();
                Profiler.EndSample();
                Profiler.BeginSample("OverlayDrawer.DrawAllOverlays()");
                this.overlayDrawer.DrawAllOverlays();
                Profiler.EndSample();
            }
            Profiler.BeginSample("AreaManagerUpdate()");
            try
            {
                this.areaManager.AreaManagerUpdate();
            }
            catch (Exception ex)
            {
                Log.Error(ex.ToString(), false);
            }
            Profiler.EndSample();
            Profiler.BeginSample("WeatherManagerUpdate()");
            this.weatherManager.WeatherManagerUpdate();
            Profiler.EndSample();
            Profiler.BeginSample("MapComponentUpdate()");
            MapComponentUtility.MapComponentUpdate(this);
            Profiler.EndSample();
        }
示例#8
0
 public void MapPostTick()
 {
     Profiler.BeginSample("WildAnimalSpawnerTick()");
     try
     {
         this.wildAnimalSpawner.WildAnimalSpawnerTick();
     }
     catch (Exception ex)
     {
         Log.Error(ex.ToString(), false);
     }
     Profiler.EndSample();
     Profiler.BeginSample("WildPlantSpawnerTick()");
     try
     {
         this.wildPlantSpawner.WildPlantSpawnerTick();
     }
     catch (Exception ex2)
     {
         Log.Error(ex2.ToString(), false);
     }
     Profiler.EndSample();
     Profiler.BeginSample("PowerNetManager.PowerNetsTick()");
     try
     {
         this.powerNetManager.PowerNetsTick();
     }
     catch (Exception ex3)
     {
         Log.Error(ex3.ToString(), false);
     }
     Profiler.EndSample();
     Profiler.BeginSample("SteadyEnvironmentEffects.SteadyEnvironmentEffectsTick()");
     try
     {
         this.steadyEnvironmentEffects.SteadyEnvironmentEffectsTick();
     }
     catch (Exception ex4)
     {
         Log.Error(ex4.ToString(), false);
     }
     Profiler.EndSample();
     Profiler.BeginSample("LordManagerTick()");
     try
     {
         this.lordManager.LordManagerTick();
     }
     catch (Exception ex5)
     {
         Log.Error(ex5.ToString(), false);
     }
     Profiler.EndSample();
     Profiler.BeginSample("PassingShipManagerTick()");
     try
     {
         this.passingShipManager.PassingShipManagerTick();
     }
     catch (Exception ex6)
     {
         Log.Error(ex6.ToString(), false);
     }
     Profiler.EndSample();
     Profiler.BeginSample("DebugDrawer.DebugDrawerTick()");
     try
     {
         this.debugDrawer.DebugDrawerTick();
     }
     catch (Exception ex7)
     {
         Log.Error(ex7.ToString(), false);
     }
     Profiler.EndSample();
     Profiler.BeginSample("VoluntarilyJoinableLordsStarterTick()");
     try
     {
         this.lordsStarter.VoluntarilyJoinableLordsStarterTick();
     }
     catch (Exception ex8)
     {
         Log.Error(ex8.ToString(), false);
     }
     Profiler.EndSample();
     Profiler.BeginSample("GameConditionManager.GameConditionManagerTick()");
     try
     {
         this.gameConditionManager.GameConditionManagerTick();
     }
     catch (Exception ex9)
     {
         Log.Error(ex9.ToString(), false);
     }
     Profiler.EndSample();
     Profiler.BeginSample("WeatherManager.WeatherManagerTick()");
     try
     {
         this.weatherManager.WeatherManagerTick();
     }
     catch (Exception ex10)
     {
         Log.Error(ex10.ToString(), false);
     }
     Profiler.EndSample();
     Profiler.BeginSample("ResourceCounter.ResourceCounterTick()");
     try
     {
         this.resourceCounter.ResourceCounterTick();
     }
     catch (Exception ex11)
     {
         Log.Error(ex11.ToString(), false);
     }
     Profiler.EndSample();
     Profiler.BeginSample("WeatherDecided.WeatherDeciderTick()");
     try
     {
         this.weatherDecider.WeatherDeciderTick();
     }
     catch (Exception ex12)
     {
         Log.Error(ex12.ToString(), false);
     }
     Profiler.EndSample();
     Profiler.BeginSample("FireWatcher.FireWatcherTick()");
     try
     {
         this.fireWatcher.FireWatcherTick();
     }
     catch (Exception ex13)
     {
         Log.Error(ex13.ToString(), false);
     }
     Profiler.EndSample();
     Profiler.BeginSample("DamageWatcher.DamageWatcherTick()");
     try
     {
         this.damageWatcher.DamageWatcherTick();
     }
     catch (Exception ex14)
     {
         Log.Error(ex14.ToString(), false);
     }
     Profiler.EndSample();
     Profiler.BeginSample("MapComponentTick()");
     MapComponentUtility.MapComponentTick(this);
     Profiler.EndSample();
 }
示例#9
0
 public void MapPostTick()
 {
     try
     {
         wildAnimalSpawner.WildAnimalSpawnerTick();
     }
     catch (Exception ex)
     {
         Log.Error(ex.ToString());
     }
     try
     {
         wildPlantSpawner.WildPlantSpawnerTick();
     }
     catch (Exception ex2)
     {
         Log.Error(ex2.ToString());
     }
     try
     {
         powerNetManager.PowerNetsTick();
     }
     catch (Exception ex3)
     {
         Log.Error(ex3.ToString());
     }
     try
     {
         steadyEnvironmentEffects.SteadyEnvironmentEffectsTick();
     }
     catch (Exception ex4)
     {
         Log.Error(ex4.ToString());
     }
     try
     {
         lordManager.LordManagerTick();
     }
     catch (Exception ex5)
     {
         Log.Error(ex5.ToString());
     }
     try
     {
         passingShipManager.PassingShipManagerTick();
     }
     catch (Exception ex6)
     {
         Log.Error(ex6.ToString());
     }
     try
     {
         debugDrawer.DebugDrawerTick();
     }
     catch (Exception ex7)
     {
         Log.Error(ex7.ToString());
     }
     try
     {
         lordsStarter.VoluntarilyJoinableLordsStarterTick();
     }
     catch (Exception ex8)
     {
         Log.Error(ex8.ToString());
     }
     try
     {
         gameConditionManager.GameConditionManagerTick();
     }
     catch (Exception ex9)
     {
         Log.Error(ex9.ToString());
     }
     try
     {
         weatherManager.WeatherManagerTick();
     }
     catch (Exception ex10)
     {
         Log.Error(ex10.ToString());
     }
     try
     {
         resourceCounter.ResourceCounterTick();
     }
     catch (Exception ex11)
     {
         Log.Error(ex11.ToString());
     }
     try
     {
         weatherDecider.WeatherDeciderTick();
     }
     catch (Exception ex12)
     {
         Log.Error(ex12.ToString());
     }
     try
     {
         fireWatcher.FireWatcherTick();
     }
     catch (Exception ex13)
     {
         Log.Error(ex13.ToString());
     }
     MapComponentUtility.MapComponentTick(this);
 }
示例#10
0
        public static Map GenerateMap(IntVec3 mapSize, MapParent parent, MapGeneratorDef mapGenerator, IEnumerable <GenStepWithParams> extraGenStepDefs = null, Action <Map> extraInitBeforeContentGen = null)
        {
            ProgramState programState = Current.ProgramState;

            Current.ProgramState            = ProgramState.MapInitializing;
            MapGenerator.playerStartSpotInt = IntVec3.Invalid;
            MapGenerator.rootsToUnfog.Clear();
            MapGenerator.data.Clear();
            MapGenerator.mapBeingGenerated = null;
            DeepProfiler.Start("InitNewGeneratedMap");
            Rand.PushState();
            int seed = Gen.HashCombineInt(Find.World.info.Seed, parent.Tile);

            Rand.Seed = seed;
            Map result;

            try
            {
                if (parent != null && parent.HasMap)
                {
                    Log.Error("Tried to generate a new map and set " + parent + " as its parent, but this world object already has a map. One world object can't have more than 1 map.", false);
                    parent = null;
                }
                DeepProfiler.Start("Set up map");
                Map map = new Map();
                map.uniqueID = Find.UniqueIDsManager.GetNextMapID();
                MapGenerator.mapBeingGenerated = map;
                map.info.Size   = mapSize;
                map.info.parent = parent;
                map.ConstructComponents();
                DeepProfiler.End();
                Current.Game.AddMap(map);
                if (extraInitBeforeContentGen != null)
                {
                    extraInitBeforeContentGen(map);
                }
                if (mapGenerator == null)
                {
                    Log.Error("Attempted to generate map without generator; falling back on encounter map", false);
                    mapGenerator = MapGeneratorDefOf.Encounter;
                }
                IEnumerable <GenStepWithParams> enumerable = from x in mapGenerator.genSteps
                                                             select new GenStepWithParams(x, default(GenStepParams));
                if (extraGenStepDefs != null)
                {
                    enumerable = enumerable.Concat(extraGenStepDefs);
                }
                map.areaManager.AddStartingAreas();
                map.weatherDecider.StartInitialWeather();
                DeepProfiler.Start("Generate contents into map");
                MapGenerator.GenerateContentsIntoMap(enumerable, map, seed);
                DeepProfiler.End();
                Find.Scenario.PostMapGenerate(map);
                DeepProfiler.Start("Finalize map init");
                map.FinalizeInit();
                DeepProfiler.End();
                DeepProfiler.Start("MapComponent.MapGenerated()");
                MapComponentUtility.MapGenerated(map);
                DeepProfiler.End();
                if (parent != null)
                {
                    parent.PostMapGenerate();
                }
                result = map;
            }
            finally
            {
                DeepProfiler.End();
                MapGenerator.mapBeingGenerated = null;
                Current.ProgramState           = programState;
                Rand.PopState();
            }
            return(result);
        }
示例#11
0
 public void MapPostTick()
 {
     try
     {
         this.wildSpawner.WildSpawnerTick();
     }
     catch (Exception ex)
     {
         Log.Error(ex.ToString());
     }
     try
     {
         this.powerNetManager.PowerNetsTick();
     }
     catch (Exception ex2)
     {
         Log.Error(ex2.ToString());
     }
     try
     {
         this.steadyAtmosphereEffects.SteadyAtmosphereEffectsTick();
     }
     catch (Exception ex3)
     {
         Log.Error(ex3.ToString());
     }
     try
     {
         this.lordManager.LordManagerTick();
     }
     catch (Exception ex4)
     {
         Log.Error(ex4.ToString());
     }
     try
     {
         this.passingShipManager.PassingShipManagerTick();
     }
     catch (Exception ex5)
     {
         Log.Error(ex5.ToString());
     }
     try
     {
         this.debugDrawer.DebugDrawerTick();
     }
     catch (Exception ex6)
     {
         Log.Error(ex6.ToString());
     }
     try
     {
         this.lordsStarter.VoluntarilyJoinableLordsStarterTick();
     }
     catch (Exception ex7)
     {
         Log.Error(ex7.ToString());
     }
     try
     {
         this.gameConditionManager.GameConditionManagerTick();
     }
     catch (Exception ex8)
     {
         Log.Error(ex8.ToString());
     }
     try
     {
         this.weatherManager.WeatherManagerTick();
     }
     catch (Exception ex9)
     {
         Log.Error(ex9.ToString());
     }
     try
     {
         this.resourceCounter.ResourceCounterTick();
     }
     catch (Exception ex10)
     {
         Log.Error(ex10.ToString());
     }
     try
     {
         this.weatherDecider.WeatherDeciderTick();
     }
     catch (Exception ex11)
     {
         Log.Error(ex11.ToString());
     }
     try
     {
         this.fireWatcher.FireWatcherTick();
     }
     catch (Exception ex12)
     {
         Log.Error(ex12.ToString());
     }
     try
     {
         this.damageWatcher.DamageWatcherTick();
     }
     catch (Exception ex13)
     {
         Log.Error(ex13.ToString());
     }
     MapComponentUtility.MapComponentTick(this);
 }
示例#12
0
        public static Map GenerateMap(IntVec3 mapSize, MapParent parent, MapGeneratorDef mapGenerator, IEnumerable <GenStepDef> extraGenStepDefs = null, Action <Map> extraInitBeforeContentGen = null)
        {
            ProgramState programState = Current.ProgramState;

            Current.ProgramState            = ProgramState.MapInitializing;
            MapGenerator.playerStartSpotInt = IntVec3.Invalid;
            MapGenerator.rootsToUnfog.Clear();
            MapGenerator.data.Clear();
            MapGenerator.mapBeingGenerated = null;
            Map result;

            try
            {
                DeepProfiler.Start("InitNewGeneratedMap");
                if (parent != null && parent.HasMap)
                {
                    Log.Error("Tried to generate a new map and set " + parent + " as its parent, but this world object already has a map. One world object can't have more than 1 map.");
                    parent = null;
                }
                DeepProfiler.Start("Set up map");
                Map map = new Map();
                map.uniqueID = Find.UniqueIDsManager.GetNextMapID();
                MapGenerator.mapBeingGenerated = map;
                map.info.Size   = mapSize;
                map.info.parent = parent;
                map.ConstructComponents();
                DeepProfiler.End();
                Current.Game.AddMap(map);
                if (extraInitBeforeContentGen != null)
                {
                    extraInitBeforeContentGen(map);
                }
                if (mapGenerator == null)
                {
                    mapGenerator = DefDatabase <MapGeneratorDef> .AllDefsListForReading.RandomElementByWeight((MapGeneratorDef x) => x.selectionWeight);
                }
                IEnumerable <GenStepDef> enumerable = mapGenerator.GenSteps;
                if (extraGenStepDefs != null)
                {
                    enumerable = enumerable.Concat(extraGenStepDefs);
                }
                map.areaManager.AddStartingAreas();
                map.weatherDecider.StartInitialWeather();
                DeepProfiler.Start("Generate contents into map");
                MapGenerator.GenerateContentsIntoMap(enumerable, map);
                DeepProfiler.End();
                Find.Scenario.PostMapGenerate(map);
                DeepProfiler.Start("Finalize map init");
                map.FinalizeInit();
                DeepProfiler.End();
                DeepProfiler.Start("MapComponent.MapGenerated()");
                MapComponentUtility.MapGenerated(map);
                DeepProfiler.End();
                if (parent != null)
                {
                    parent.PostMapGenerate();
                }
                result = map;
            }
            finally
            {
                DeepProfiler.End();
                MapGenerator.mapBeingGenerated = null;
                Current.ProgramState           = programState;
            }
            return(result);
        }