public void DoExposeWork() { byte[] arr = null; if (Scribe.mode == LoadSaveMode.Saving) { int num = Mathf.RoundToInt(this.map.mapTemperature.OutdoorTemp); ushort num2 = this.TempFloatToShort((float)num); ushort[] tempGrid = new ushort[this.map.cellIndices.NumGridCells]; for (int i = 0; i < this.map.cellIndices.NumGridCells; i++) { tempGrid[i] = num2; } foreach (Region current in this.map.regionGrid.AllRegions_NoRebuild_InvalidAllowed) { if (current.Room != null) { ushort num3 = this.TempFloatToShort(current.Room.Temperature); foreach (IntVec3 current2 in current.Cells) { tempGrid[this.map.cellIndices.CellToIndex(current2)] = num3; } } } arr = MapSerializeUtility.SerializeUshort(this.map, (IntVec3 c) => tempGrid[this.map.cellIndices.CellToIndex(c)]); } DataExposeUtility.ByteArray(ref arr, "temperatures"); if (Scribe.mode == LoadSaveMode.LoadingVars) { this.tempGrid = new ushort[this.map.cellIndices.NumGridCells]; MapSerializeUtility.LoadUshort(arr, this.map, delegate(IntVec3 c, ushort val) { this.tempGrid[this.map.cellIndices.CellToIndex(c)] = val; }); } }
public static void ExposeUshort(Map map, Func <IntVec3, ushort> shortReader, Action <IntVec3, ushort> shortWriter, string label) { byte[] arr = null; if (Scribe.mode == LoadSaveMode.Saving) { arr = MapSerializeUtility.SerializeUshort(map, shortReader); } DataExposeUtility.ByteArray(ref arr, label); if (Scribe.mode == LoadSaveMode.LoadingVars) { MapSerializeUtility.LoadUshort(arr, map, shortWriter); } }
public void BuildCompressedString() { this.compressibilityDecider = new CompressibilityDecider(this.map); this.compressibilityDecider.DetermineReferences(); this.compressedData = MapSerializeUtility.SerializeUshort(this.map, new Func <IntVec3, ushort>(this.HashValueForSquare)); }
public void BuildCompressedString() { compressibilityDecider = new CompressibilityDecider(map); compressibilityDecider.DetermineReferences(); compressedData = MapSerializeUtility.SerializeUshort(map, HashValueForSquare); }