/// <summary> /// Writes the data element into the given buffer (at its current position). /// </summary> /// <param name="buffer">The buffer where the data element should be deserialized into.</param> public void WriteData(RAMBuffer buffer) { buffer.WriteUShort((ushort)PlayerName.Length); buffer.WriteString(PlayerName); buffer.WriteFloat(InitialCameraX); buffer.WriteFloat(InitialCameraY); buffer.WriteShort(UnknownX); buffer.WriteShort(UnknownY); buffer.WriteByte(AlliedVictory); ScenarioDataElementTools.AssertTrue(Diplomacy1.Count == Diplomacy2.Count); buffer.WriteUShort((ushort)Diplomacy1.Count); Diplomacy1.ForEach(d => buffer.WriteByte((byte)d)); Diplomacy2.ForEach(d => buffer.WriteUInteger((uint)d)); buffer.WriteUInteger(Color); buffer.WriteFloat(Unknown1); buffer.WriteUShort(Unknown3Count); if (Unknown1 == 2) { ScenarioDataElementTools.AssertListLength(Unknown2, 8); Unknown2.ForEach(b => buffer.WriteByte(b)); } ScenarioDataElementTools.AssertListLength(Unknown3, Unknown3Count * 44); Unknown3.ForEach(b => buffer.WriteByte(b)); ScenarioDataElementTools.AssertListLength(Unknown4, 7); Unknown4.ForEach(b => buffer.WriteByte(b)); buffer.WriteInteger(Unknown5); }