private static void OnSaveData() { FastList <byte> data = new FastList <byte>(); try { SerializableDataExtension.WriteString(CachedVehicleData._dataVersion, data); for (int index = 0; index < CachedVehicleData.MaxVehicleCount; ++index) { if (!CachedVehicleData.m_cachedVehicleData[index].IsEmpty) { SerializableDataExtension.WriteInt32(index, data); SerializableDataExtension.WriteInt32(CachedVehicleData.m_cachedVehicleData[index].LastStopNewPassengers, data); SerializableDataExtension.WriteInt32(CachedVehicleData.m_cachedVehicleData[index].LastStopGonePassengers, data); SerializableDataExtension.WriteInt32(CachedVehicleData.m_cachedVehicleData[index].PassengersThisWeek, data); SerializableDataExtension.WriteInt32(CachedVehicleData.m_cachedVehicleData[index].PassengersLastWeek, data); SerializableDataExtension.WriteInt32(CachedVehicleData.m_cachedVehicleData[index].IncomeThisWeek, data); SerializableDataExtension.WriteInt32(CachedVehicleData.m_cachedVehicleData[index].IncomeLastWeek, data); SerializableDataExtension.WriteFloatArray(CachedVehicleData.m_cachedVehicleData[index].PassengerData, data); SerializableDataExtension.WriteFloatArray(CachedVehicleData.m_cachedVehicleData[index].IncomeData, data); SerializableDataExtension.WriteUInt16(CachedVehicleData.m_cachedVehicleData[index].CurrentStop, data); } } SerializableDataExtension.instance.SerializableData.SaveData(CachedVehicleData._dataID, data.ToArray()); } catch (Exception ex) { Utils.LogError((object)("Error while saving vehicle data! " + ex.Message + " " + (object)ex.InnerException)); } }
private static void OnSaveData() { FastList <byte> data = new FastList <byte>(); try { SerializableDataExtension.WriteString(CachedNodeData._dataVersion, data); for (int index = 0; index < 32768; ++index) { if (!CachedNodeData.m_cachedNodeData[index].IsEmpty) { SerializableDataExtension.WriteInt32(index, data); SerializableDataExtension.WriteInt32(CachedNodeData.m_cachedNodeData[index].PassengersIn, data); SerializableDataExtension.WriteInt32(CachedNodeData.m_cachedNodeData[index].PassengersOut, data); SerializableDataExtension.WriteInt32(CachedNodeData.m_cachedNodeData[index].LastWeekPassengersIn, data); SerializableDataExtension.WriteInt32(CachedNodeData.m_cachedNodeData[index].LastWeekPassengersOut, data); SerializableDataExtension.WriteFloatArray(CachedNodeData.m_cachedNodeData[index].PassengerInData, data); SerializableDataExtension.WriteFloatArray(CachedNodeData.m_cachedNodeData[index].PassengerOutData, data); SerializableDataExtension.WriteBool(CachedNodeData.m_cachedNodeData[index].Unbunching, data); } } SerializableDataExtension.instance.SerializableData.SaveData(CachedNodeData._dataID, data.ToArray()); } catch (Exception ex) { Utils.LogError((object)("Error while saving net node data! " + ex.Message + " " + (object)ex.InnerException)); } }