| | | 1 | | //======================================================================= |
| | | 2 | | // NavigationOperationFrameChange.cs |
| | | 3 | | //======================================================================= |
| | | 4 | | // MIT License, Copyright (c) 2024-present David Oravsky (mrdav30) |
| | | 5 | | // See LICENSE file in the project root for full license information. |
| | | 6 | | //======================================================================= |
| | | 7 | | |
| | | 8 | | namespace Trailblazer.Pathing; |
| | | 9 | | |
| | | 10 | | internal enum NavigationOperationFrameChangeKind |
| | | 11 | | { |
| | | 12 | | MapCommit, |
| | | 13 | | MapRemove, |
| | | 14 | | Overlay |
| | | 15 | | } |
| | | 16 | | |
| | | 17 | | internal readonly struct NavigationOperationFrameChange |
| | | 18 | | { |
| | | 19 | | private NavigationOperationFrameChange( |
| | | 20 | | NavigationOperationFrameChangeKind kind, |
| | | 21 | | string? mapId, |
| | | 22 | | PreparedNavigationMap? preparedMap, |
| | | 23 | | PreparedNavigationOverlay? preparedOverlay, |
| | | 24 | | OverlayReplacementPolicy replacementPolicy, |
| | | 25 | | long operationSequence) |
| | | 26 | | { |
| | 38400 | 27 | | Kind = kind; |
| | 38400 | 28 | | MapId = mapId; |
| | 38400 | 29 | | PreparedMap = preparedMap; |
| | 38400 | 30 | | PreparedOverlay = preparedOverlay; |
| | 38400 | 31 | | ReplacementPolicy = replacementPolicy; |
| | 38400 | 32 | | OperationSequence = operationSequence; |
| | 38400 | 33 | | } |
| | | 34 | | |
| | | 35 | | internal NavigationOperationFrameChangeKind Kind { get; } |
| | | 36 | | internal string? MapId { get; } |
| | | 37 | | internal PreparedNavigationMap? PreparedMap { get; } |
| | | 38 | | internal PreparedNavigationOverlay? PreparedOverlay { get; } |
| | | 39 | | internal OverlayReplacementPolicy ReplacementPolicy { get; } |
| | | 40 | | internal long OperationSequence { get; } |
| | | 41 | | |
| | | 42 | | internal static NavigationOperationFrameChange MapCommit( |
| | | 43 | | PreparedNavigationMap map, |
| | | 44 | | OverlayReplacementPolicy replacementPolicy, |
| | 37421 | 45 | | long operationSequence) => new( |
| | 37421 | 46 | | NavigationOperationFrameChangeKind.MapCommit, |
| | 37421 | 47 | | map.Map.MapId, |
| | 37421 | 48 | | map, |
| | 37421 | 49 | | preparedOverlay: null, |
| | 37421 | 50 | | replacementPolicy, |
| | 37421 | 51 | | operationSequence); |
| | | 52 | | |
| | | 53 | | internal static NavigationOperationFrameChange MapRemove( |
| | | 54 | | string mapId, |
| | 18 | 55 | | long operationSequence) => new( |
| | 18 | 56 | | NavigationOperationFrameChangeKind.MapRemove, |
| | 18 | 57 | | mapId, |
| | 18 | 58 | | preparedMap: null, |
| | 18 | 59 | | preparedOverlay: null, |
| | 18 | 60 | | OverlayReplacementPolicy.PreserveAndRevalidate, |
| | 18 | 61 | | operationSequence); |
| | | 62 | | |
| | | 63 | | internal static NavigationOperationFrameChange Overlay( |
| | | 64 | | PreparedNavigationOverlay overlay, |
| | 961 | 65 | | long operationSequence) => new( |
| | 961 | 66 | | NavigationOperationFrameChangeKind.Overlay, |
| | 961 | 67 | | mapId: null, |
| | 961 | 68 | | preparedMap: null, |
| | 961 | 69 | | overlay, |
| | 961 | 70 | | OverlayReplacementPolicy.PreserveAndRevalidate, |
| | 961 | 71 | | operationSequence); |
| | | 72 | | } |
| | | 73 | | |
| | | 74 | | internal delegate NavigationCandidatePublication NavigationCandidatePublisher( |
| | | 75 | | NavigationOperationCandidate candidate, |
| | | 76 | | int frame, |
| | | 77 | | NavigationOperationFrameChange[] changes, |
| | | 78 | | int changeCount); |
| | | 79 | | |
| | | 80 | | internal delegate bool NavigationRetainedWorkGuard(long retainedBytes, int persistentPages); |