diff --git a/CriticalPathAnalyzer/CriticalPathAnalyzer/src/client/tool/CriticalPathAnalyzerTool.cs b/CriticalPathAnalyzer/CriticalPathAnalyzer/src/client/tool/CriticalPathAnalyzerTool.cs index 39fe1f8..6d73037 100644 --- a/CriticalPathAnalyzer/CriticalPathAnalyzer/src/client/tool/CriticalPathAnalyzerTool.cs +++ b/CriticalPathAnalyzer/CriticalPathAnalyzer/src/client/tool/CriticalPathAnalyzerTool.cs @@ -29,11 +29,11 @@ namespace CriticalPathAnalyzer.Client.Tool { PathHighLighter.RemoveHighLighting(); } - private static PegAddress? RayCastPeg() { + private static PegAddress RayCastPeg() { // Ray-cast into the world to find what the player is looking at HitInfo hitInfo = PlayerCaster.CameraCast(Masks.Environment | Masks.Structure | Masks.Peg | Masks.Wire); if (!hitInfo.HitSomething) { - return null; + return PegAddress.Empty; } // Resolve hit target: @@ -50,15 +50,15 @@ namespace CriticalPathAnalyzer.Client.Tool { return wire.Point1.IsInputAddress() ? wire.Point1 : wire.Point2; } - return null; + return PegAddress.Empty; } public static void SelectPathStart() { _logger.Info("Analyze Path Start"); - PegAddress? pegAddress = RayCastPeg(); - if (pegAddress != null) { - _startPegAddress = pegAddress.Value; - if (_startPegAddress != null && _endPegAddress != null) { + PegAddress pegAddress = RayCastPeg(); + if (!pegAddress.IsEmpty()) { + _startPegAddress = pegAddress; + if (!_startPegAddress.IsEmpty() && !_endPegAddress.IsEmpty()) { CalculateCriticalPath(); } } @@ -66,10 +66,10 @@ namespace CriticalPathAnalyzer.Client.Tool { public static void SelectPathEnd() { _logger.Info("Analyze Path End"); - PegAddress? pegAddress = RayCastPeg(); - if (pegAddress != null) { - _endPegAddress = pegAddress.Value; - if (_startPegAddress != null && _endPegAddress != null) { + PegAddress pegAddress = RayCastPeg(); + if (!pegAddress.IsEmpty()) { + _endPegAddress = pegAddress; + if (!_startPegAddress.IsEmpty() && !_endPegAddress.IsEmpty()) { CalculateCriticalPath(); } }