* AntennaRelay.cs:
[AntennaRange.git] / Extensions.cs
blob:a/Extensions.cs -> blob:b/Extensions.cs
--- a/Extensions.cs
+++ b/Extensions.cs
@@ -1,3 +1,20 @@
+// AntennaRange © 2014 toadicus
+//
+// AntennaRange provides incentive and requirements for the use of the various antenna parts.
+// Nominally, the breakdown is as follows:
+//
+//     Communotron 16 - Suitable up to Kerbalsynchronous Orbit
+//     Comms DTS-M1 - Suitable throughout the Kerbin subsystem
+//     Communotron 88-88 - Suitable throughout the Kerbol system.
+//
+// This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. To view a
+// copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/
+//
+// This software uses the ModuleManager library © 2013 ialdabaoth, used under a Creative Commons Attribution-ShareAlike
+// 3.0 Uported License.
+//
+// This software uses code from the MuMechLib library, © 2013 r4m0n, used under the GNU GPL version 3.
+
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -98,13 +115,14 @@
 				Transmitters = new List<IAntennaRelay>();
 
 				// Loop through the ProtoPartModuleSnapshots in this Vessel
-				foreach (ProtoPartModuleSnapshot ms in vessel.protoVessel.protoPartSnapshots.SelectMany(ps => ps.modules))
+				foreach (ProtoPartSnapshot pps in vessel.protoVessel.protoPartSnapshots)
 				{
+					ProtoPartModuleSnapshot ppms = pps.modules.FirstOrDefault(p => p.IsAntenna());
 					// If they are antennas...
-					if (ms.IsAntenna())
+					if (ppms != null)
 					{
 						// ...add a new ProtoAntennaRelay wrapper to the list.
-						Transmitters.Add(new ProtoAntennaRelay(ms, vessel));
+						Transmitters.Add(new ProtoAntennaRelay(ppms, pps, vessel));
 					}
 				}
 			}