Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
41 changes: 14 additions & 27 deletions KSP Navigation/NavUtilLib/GlobalVariables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,34 +135,21 @@ public static void updateNavigationData()
selectedRwy = rwyList[rwyIdx];

//Since there seems to be no callback methods to determine whether waypoint has been set or changed, we have to refresh INS data on every update
NavWaypoint navpoint = FinePrint.WaypointManager.navWaypoint;
if (FinePrint.WaypointManager.navIsActive() && (navpoint != null))
NavWaypoint waypoint = NavWaypoint.fetch;
if ((waypoint != null) && waypoint.IsActive)
{
//Trying to find the FinePrint waypoint that navigation is set for:
Waypoint waypoint = null;

foreach (Waypoint wp in FinePrint.WaypointManager.Instance().Waypoints)
{
if (navpoint.latitude == wp.latitude && navpoint.longitude == wp.longitude)
{
waypoint = wp;
break;
}
}
if (waypoint != null)
{
//If waypoint is fine then generate fake target runway every time
Runway insTarget = new Runway();
insTarget.isINSTarget = true;
insTarget.ident = waypoint.name;
insTarget.hdg = selectedRwy != null ? selectedRwy.hdg : 0;
insTarget.altMSL = (float)(waypoint.height + waypoint.altitude);
insTarget.locLatitude = (float)navpoint.latitude;
insTarget.locLongitude = (float)navpoint.longitude;
insTarget.gsLatitude = (float)navpoint.latitude;
insTarget.gsLongitude = (float)navpoint.longitude;
selectedRwy = insTarget;
}
//If waypoint is fine then generate fake target runway every time
Runway insTarget = new Runway();
insTarget.isINSTarget = true;
insTarget.ident = waypoint.name;
insTarget.body = waypoint.Body.name;
insTarget.hdg = selectedRwy != null ? selectedRwy.hdg : 0;
insTarget.altMSL = (float)(waypoint.Height + waypoint.Altitude);
insTarget.locLatitude = (float)waypoint.Latitude;
insTarget.locLongitude = (float)waypoint.Longitude;
insTarget.gsLatitude = (float)waypoint.Latitude;
insTarget.gsLongitude = (float)waypoint.Longitude;
selectedRwy = insTarget;
}

currentVessel = FlightGlobals.ActiveVessel;
Expand Down
2 changes: 1 addition & 1 deletion KSP Navigation/NavUtilLib/GraphicUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public static Material loadMaterial(string fileName, Material mat, int width, in
private static Texture2D texFile(string fileName, int w, int h)
{
Texture2D t = new Texture2D(w, h);
t.LoadImage(KSP.IO.File.ReadAllBytes<NavUtilLibApp>(fileName));
t.LoadImage(KSP.IO.File.ReadAllBytes<NavUtilLibApp>(fileName, null));
return t;
}
}
Expand Down
2 changes: 1 addition & 1 deletion KSP Navigation/NavUtilLib/NavUtilLibHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ private void OnWindow(int WindowID)
{
//displayHSI();
//Debug.Log("CloseHSI");
appButton.SetFalse();
appButton.SetFalse(true);
//goto CloseWindow;
}

Expand Down