public override void Serialize(LittleEndianWriter writer) { int waypointsSize = Waypoints.Length; if (waypointsSize > 0x7F) { throw new Exception("Too many paths > 0x7F!"); } byte bitfield = 0; if (Waypoints != null) { bitfield |= (byte)(waypointsSize << 1); } if (HasTeleportID) { bitfield |= 1; } writer.WriteByte(4);//bitfield); if (Waypoints != null) { writer.WriteUInt(TeleportNetID); if (HasTeleportID) { writer.WriteByte(TeleportID); } writer.WriteWaypointSpeedParams(SpeedParams); writer.WriteCompressedWaypoints(Waypoints); } }