From d65aeb7ba53ef5330f9d2764718e5561599939c8 Mon Sep 17 00:00:00 2001 From: D4VID Date: Sat, 1 Mar 2025 19:52:20 +0100 Subject: [PATCH] Use PegAddress.Empty in RayCastPeg --- .../client/tool/CriticalPathAnalyzerTool.cs | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) 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(); } }