Skip to content

Commit

Permalink
Fixed nullref when using the equals sign and at the end of the list …
Browse files Browse the repository at this point in the history
…of cameras.

 Added code to allow a docking node to be a target and have the docking info displayed on the docking camera
  • Loading branch information
linuxgurugamer committed Nov 21, 2018
1 parent bcee6f5 commit e5fd305
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 8 deletions.
6 changes: 5 additions & 1 deletion Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,8 @@
Fixed the KSC Launchpad Camera so it now is there
Removed the obsolete impactTolerance variable
Thanks to @Gordon Dry for this: patch to avoid the EVA cam to be added when the mod ThroughTheEyes is already installed.
Simplified the kerbalEVA patch
Simplified the kerbalEVA patch

0.1.9.10
Fixed nullref when using the equals sign and at the end of the list of cameras.
Added code to allow a docking node to be a target and have the docking info displayed on the docking camera
2 changes: 1 addition & 1 deletion GameData/HullCameraVDS/HullcamVDSContinued.version
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"MAJOR": 0,
"MINOR": 1,
"PATCH": 9,
"BUILD": 9
"BUILD": 10
},
"KSP_VERSION": {
"MAJOR": 1,
Expand Down
2 changes: 1 addition & 1 deletion HullCamera/AssemblyVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@

using System.Reflection;

[assembly: AssemblyVersion("0.1.9.9")]
[assembly: AssemblyVersion("0.1.9.10")]
11 changes: 8 additions & 3 deletions HullCamera/MovieTime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,9 @@ public void Update()
{
print(currentMode);
}

HasTargetData = (FlightGlobals.ActiveVessel.targetObject is Vessel);
if (FlightGlobals.ActiveVessel.targetObject == null)
return;
HasTargetData = (FlightGlobals.ActiveVessel.targetObject is Vessel || FlightGlobals.ActiveVessel.targetObject is ModuleDockingNode);
currentMode = GetCameraMode().ToString();

if (HasTargetData)
Expand All @@ -152,7 +153,11 @@ public void Update()
targetVelY = Math.Round(Vector3d.Dot(FlightGlobals.ship_tgtVelocity, FlightGlobals.ActiveVessel.ReferenceTransform.forward), 3);
targetVelZ = Math.Round(Vector3d.Dot(FlightGlobals.ship_tgtVelocity, FlightGlobals.ActiveVessel.ReferenceTransform.up), 3);

Vessel targetVessel = (Vessel)FlightGlobals.ActiveVessel.targetObject;
Vessel targetVessel;
if (FlightGlobals.ActiveVessel.targetObject is Vessel)
targetVessel = (Vessel)FlightGlobals.ActiveVessel.targetObject;
else
targetVessel = ((ModuleDockingNode)FlightGlobals.ActiveVessel.targetObject).vessel;
Orbit activeOrbit = FlightGlobals.ActiveVessel.orbit;
Orbit targetOrbit = targetVessel.orbit;

Expand Down
2 changes: 1 addition & 1 deletion HullCamera/MuMechModuleHullCamera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ protected static void CycleCamera(int direction)

// Iterates the number of cameras and returns as soon as a camera is chosen.
// Then if no camera is chosen, restore main camera as a last-ditch effort.
for (int i = 0; i < sCameras.Count + 1; i += 1)
for (int i = 0; i < sCameras.Count - 1; i++)
{

// Check if cycle direction is referse and if the current cam is the first hullcam
Expand Down
2 changes: 1 addition & 1 deletion HullcamVDSContinued.version
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"MAJOR": 0,
"MINOR": 1,
"PATCH": 9,
"BUILD": 9
"BUILD": 10
},
"KSP_VERSION": {
"MAJOR": 1,
Expand Down

0 comments on commit e5fd305

Please sign in to comment.