@@ -179,8 +179,8 @@ public static Guid[] GetControlPath(Guid id)
179179 List < NetworkLink < ISatellite > > bestRouter = RTCore . Instance . Network [ satellite ] . Where ( r => RTCore . Instance . Network . GroundStations . ContainsKey ( r . Goal . Guid ) ) . Min ( ) . Links ;
180180 Guid [ ] guids = new Guid [ bestRouter . Count - 1 ] ;
181181
182- // Get all satellites, not the last jump that is a station ground
183- for ( int i = 0 ; i < bestRouter . Count - 1 ; i ++ )
182+ // Get all satellites till the ground station
183+ for ( int i = 0 ; i < bestRouter . Count ; i ++ )
184184 {
185185 guids [ i ] = bestRouter [ i ] . Target . Guid ;
186186 }
@@ -460,7 +460,7 @@ public static bool GetPowerDownGuid(Guid id)
460460
461461 /// <summary>
462462 /// Get the maximum range distance between the satellites A and B based on current Range Model
463- /// and no restrictions (such as LoS) applied
463+ /// and valid direct connection.
464464 /// </summary>
465465 /// <param name="sat_a">The satellite id.</param>
466466 /// <param name="sat_b">The satellite id.</param>
@@ -470,8 +470,8 @@ public static double GetMaxRangeDistance(Guid sat_a, Guid sat_b)
470470 if ( RTCore . Instance == null ) return 0.0 ;
471471
472472 //sanity check
473- var satelliteA = RTCore . Instance . Satellites [ sat_a ] ;
474- var satelliteB = RTCore . Instance . Satellites [ sat_b ] ;
473+ var satelliteA = RTCore . Instance . Network [ sat_a ] ;
474+ var satelliteB = RTCore . Instance . Network [ sat_b ] ;
475475 if ( satelliteA == null || satelliteB == null ) return 0.0 ;
476476
477477 //get link object
@@ -506,5 +506,21 @@ public static double GetMaxRangeDistance(Guid sat_a, Guid sat_b)
506506
507507 return maxDistance ;
508508 }
509+
510+ /// <summary>
511+ /// Get the range distance between the satellites A and B.
512+ /// </summary>
513+ /// <param name="sat_a">The satellite id.</param>
514+ /// <param name="sat_b">The satellite id.</param>
515+ /// <returns>Positive number</returns>
516+ public static double GetRangeDistance ( Guid sat_a , Guid sat_b )
517+ {
518+ if ( RTCore . Instance == null ) return 0.0 ;
519+ var satelliteA = RTCore . Instance . Network [ sat_a ] ;
520+ var satelliteB = RTCore . Instance . Network [ sat_b ] ;
521+ if ( satelliteA == null || satelliteB == null ) return 0.0 ;
522+
523+ return RangeModelExtensions . DistanceTo ( satelliteA , satelliteB ) ;
524+ }
509525 }
510526}
0 commit comments