public void ExposeData() { Scribe_Values.Look <int>(ref this.trueCountInt, "trueCount", 0, false); Scribe_Values.Look <int>(ref this.mapSizeX, "mapSizeX", 0, false); Scribe_Values.Look <int>(ref this.mapSizeZ, "mapSizeZ", 0, false); DataExposeUtility.BoolArray(ref this.arr, this.mapSizeX * this.mapSizeZ, "arr"); }
public void ExposeData() { Scribe_Values.Look(ref trueCountInt, "trueCount", 0); Scribe_Values.Look(ref mapSizeX, "mapSizeX", 0); Scribe_Values.Look(ref mapSizeZ, "mapSizeZ", 0); DataExposeUtility.BoolArray(ref arr, mapSizeX * mapSizeZ, "arr"); }
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 void ExposeData() { Scribe_Values.Look(ref trueCountInt, "trueCount", 0); Scribe_Values.Look(ref mapSizeX, "mapSizeX", 0); Scribe_Values.Look(ref mapSizeZ, "mapSizeZ", 0); DataExposeUtility.BoolArray(ref arr, mapSizeX * mapSizeZ, "arr"); if (Scribe.mode == LoadSaveMode.LoadingVars) { minPossibleTrueIndexDirty = true; } }
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 static void ByteArray(ref byte[] arr, string label) { if (Scribe.mode == LoadSaveMode.Saving) { if (arr != null) { byte[] array = CompressUtility.Compress(arr); if (array.Length < arr.Length) { string text = DataExposeUtility.AddLineBreaksToLongString(Convert.ToBase64String(array)); Scribe_Values.Look <string>(ref text, label + "Deflate", null, false); } else { string text2 = DataExposeUtility.AddLineBreaksToLongString(Convert.ToBase64String(arr)); Scribe_Values.Look <string>(ref text2, label, null, false); } } } if (Scribe.mode == LoadSaveMode.LoadingVars) { string text3 = null; Scribe_Values.Look <string>(ref text3, label + "Deflate", null, false); if (text3 != null) { arr = CompressUtility.Decompress(Convert.FromBase64String(DataExposeUtility.RemoveLineBreaks(text3))); } else { Scribe_Values.Look <string>(ref text3, label, null, false); if (text3 != null) { arr = Convert.FromBase64String(DataExposeUtility.RemoveLineBreaks(text3)); } else { arr = null; } } } }
public void ExposeData() { DataExposeUtility.BoolArray(ref fogGrid, map.Area, "fogGrid"); }
public override void ExposeData() { base.ExposeData(); DataExposeUtility.ByteArray(ref this.riverOffsetMap, "riverOffsetMap"); this.GenerateRiverFlowMap(); }
public void ExposeData() { DataExposeUtility.ByteArray(ref this.compressedData, "compressedThingMap"); }
public void ExposeData() { Scribe_Values.Look(ref mapSizeX, "mapSizeX", 0); Scribe_Values.Look(ref mapSizeZ, "mapSizeZ", 0); DataExposeUtility.ByteArray(ref grid, "grid"); }
public void ExposeData() { Scribe_Values.Look <int>(ref this.mapSizeX, "mapSizeX", 0, false); Scribe_Values.Look <int>(ref this.mapSizeZ, "mapSizeZ", 0, false); DataExposeUtility.ByteArray(ref this.grid, "grid"); }
public static void BoolArray(ref bool[] arr, int elements, string label) { if (Scribe.mode == LoadSaveMode.Saving) { if (arr.Length != elements) { Log.ErrorOnce(string.Format("Bool array length mismatch for {0}", label), 74135877); } elements = arr.Length; } int num = (elements + 7) / 8; byte[] array = null; if (Scribe.mode == LoadSaveMode.Saving) { array = new byte[num]; int num2 = 0; byte b = 1; for (int i = 0; i < elements; i++) { if (arr[i]) { array[num2] |= b; } b = (byte)(b * 2); if (b == 0) { b = 1; num2++; } } } DataExposeUtility.ByteArray(ref array, label); if (Scribe.mode == LoadSaveMode.LoadingVars) { if (arr == null) { arr = new bool[elements]; } if (array != null && array.Length != 0) { if (array.Length != num) { int num3 = 0; byte b2 = 1; for (int j = 0; j < elements; j++) { arr[j] = ((array[num3] & b2) != 0); b2 = (byte)(b2 * 2); if (b2 > 32) { b2 = 1; num3++; } } } else { int num4 = 0; byte b3 = 1; for (int k = 0; k < elements; k++) { arr[k] = ((array[num4] & b3) != 0); b3 = (byte)(b3 * 2); if (b3 == 0) { b3 = 1; num4++; } } } } } }