diff --git a/LibBSP/Source/Structs/BSP/LODTerrain.cs b/LibBSP/Source/Structs/BSP/LODTerrain.cs
index 762effe..91bda7a 100644
--- a/LibBSP/Source/Structs/BSP/LODTerrain.cs
+++ b/LibBSP/Source/Structs/BSP/LODTerrain.cs
@@ -365,6 +365,50 @@ namespace LibBSP {
Parent = parent;
}
+ ///
+ /// Creates a new by copying the fields in , using
+ /// to get and
+ /// to use when creating the new .
+ /// If the 's 's is different from
+ /// the one from , it does not matter, because fields are copied by name.
+ ///
+ /// The to copy.
+ ///
+ /// The to use as the of the new .
+ /// Use null to use the 's instead.
+ ///
+ public LODTerrain(LODTerrain source, ILump parent) {
+ Parent = parent;
+
+ if (parent != null && parent.Bsp != null) {
+ if (source.Parent != null && source.Parent.Bsp != null && source.Parent.Bsp.version == parent.Bsp.version && source.LumpVersion == parent.LumpInfo.version) {
+ Data = new byte[source.Data.Length];
+ Array.Copy(source.Data, Data, source.Data.Length);
+ return;
+ } else {
+ Data = new byte[GetStructLength(parent.Bsp.version, parent.LumpInfo.version)];
+ }
+ } else {
+ if (source.Parent != null && source.Parent.Bsp != null) {
+ Data = new byte[GetStructLength(source.Parent.Bsp.version, source.Parent.LumpInfo.version)];
+ } else {
+ Data = new byte[GetStructLength(MapType.Undefined, 0)];
+ }
+ }
+
+ Flags = source.Flags;
+ Scale = source.Scale;
+ LightmapCoordinates = source.LightmapCoordinates;
+ UVs = source.UVs;
+ X = source.X;
+ Y = source.Y;
+ BaseZ = source.BaseZ;
+ TextureIndex = source.TextureIndex;
+ Lightmap = source.Lightmap;
+ VertexFlags = source.VertexFlags;
+ Heightmap = source.Heightmap;
+ }
+
///
/// Factory method to parse a byte array into a .
///