public static void GenerateContentsIntoMap(IEnumerable <GenStepDef> genStepDefs, Map map) { Rand.Seed = Gen.HashCombineInt(Find.World.info.Seed, map.Tile); MapGenerator.data.Clear(); RockNoises.Init(map); foreach (GenStepDef current in from x in genStepDefs orderby x.order, x.index select x) { DeepProfiler.Start("GenStep - " + current); try { current.genStep.Generate(map); } catch (Exception arg) { Log.Error("Error in GenStep: " + arg); } finally { DeepProfiler.End(); } } Rand.RandomizeStateFromTime(); RockNoises.Reset(); MapGenerator.data.Clear(); }
public static void GenerateContentsIntoMap(IEnumerable <GenStepWithParams> genStepDefs, Map map, int seed) { data.Clear(); Rand.PushState(); try { Rand.Seed = seed; RockNoises.Init(map); tmpGenSteps.Clear(); tmpGenSteps.AddRange(from x in genStepDefs orderby x.def.order, x.def.index select x); for (int i = 0; i < tmpGenSteps.Count; i++) { GenStepWithParams genStepWithParams = tmpGenSteps[i]; DeepProfiler.Start("GenStep - " + genStepWithParams.def); try { Rand.Seed = Gen.HashCombineInt(seed, GetSeedPart(tmpGenSteps, i)); GenStepWithParams genStepWithParams2 = tmpGenSteps[i]; GenStep genStep = genStepWithParams2.def.genStep; GenStepWithParams genStepWithParams3 = tmpGenSteps[i]; genStep.Generate(map, genStepWithParams3.parms); } catch (Exception arg) { Log.Error("Error in GenStep: " + arg); } finally { DeepProfiler.End(); } } } finally { Rand.PopState(); RockNoises.Reset(); data.Clear(); } }