| | | 1 | | //======================================================================= |
| | | 2 | | // NavigationGridBaselineCapture.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 | | using GridForge.Configuration; |
| | | 9 | | using GridForge.Grids; |
| | | 10 | | |
| | | 11 | | namespace Trailblazer.Pathing; |
| | | 12 | | |
| | | 13 | | /// <summary>Owns one detached GridForge address baseline captured during a short maintenance gate.</summary> |
| | | 14 | | internal readonly struct NavigationGridBaselineCapture |
| | | 15 | | { |
| | | 16 | | internal NavigationGridBaselineCapture( |
| | | 17 | | int addressCount, |
| | | 18 | | GridNavigationBaseline? baseline, |
| | | 19 | | bool isDelta) |
| | | 20 | | { |
| | 1065 | 21 | | AddressCount = addressCount; |
| | 1065 | 22 | | Baseline = baseline; |
| | 1065 | 23 | | PreparedPages = null; |
| | 1065 | 24 | | CapturedChangeSequence = baseline?.CapturedChangeSequence ?? 0; |
| | 1065 | 25 | | WorldSpawnToken = baseline?.WorldSpawnToken ?? 0; |
| | 1065 | 26 | | GridIndex = baseline?.GridIndex ?? ushort.MaxValue; |
| | 1065 | 27 | | GridSpawnToken = baseline?.GridSpawnToken ?? 0; |
| | 1065 | 28 | | GridLastChangeSequence = baseline?.GridLastChangeSequence ?? 0; |
| | 1065 | 29 | | ConfigurationKey = baseline?.ConfigurationKey ?? default; |
| | 1065 | 30 | | IsDelta = isDelta; |
| | 1065 | 31 | | IsRequested = true; |
| | 1065 | 32 | | } |
| | | 33 | | |
| | | 34 | | internal NavigationGridBaselineCapture( |
| | | 35 | | int addressCount, |
| | | 36 | | PersistentIntMap<NavigationPhysicalPage> preparedPages, |
| | | 37 | | ulong capturedChangeSequence, |
| | | 38 | | long worldSpawnToken, |
| | | 39 | | ushort gridIndex, |
| | | 40 | | long gridSpawnToken, |
| | | 41 | | ulong gridLastChangeSequence, |
| | | 42 | | GridConfigurationKey configurationKey) |
| | | 43 | | { |
| | 628 | 44 | | AddressCount = addressCount; |
| | 628 | 45 | | Baseline = null; |
| | 628 | 46 | | PreparedPages = preparedPages; |
| | 628 | 47 | | CapturedChangeSequence = capturedChangeSequence; |
| | 628 | 48 | | WorldSpawnToken = worldSpawnToken; |
| | 628 | 49 | | GridIndex = gridIndex; |
| | 628 | 50 | | GridSpawnToken = gridSpawnToken; |
| | 628 | 51 | | GridLastChangeSequence = gridLastChangeSequence; |
| | 628 | 52 | | ConfigurationKey = configurationKey; |
| | 628 | 53 | | IsDelta = false; |
| | 628 | 54 | | IsRequested = true; |
| | 628 | 55 | | } |
| | | 56 | | |
| | | 57 | | internal NavigationGridBaselineCapture( |
| | | 58 | | NavigationMapInstance preparedInstance, |
| | | 59 | | NavigationSurfaceComponentKeySet structuralChangedStates, |
| | | 60 | | bool defaultPhysicalAddressSetChanged, |
| | | 61 | | int addressCount, |
| | | 62 | | ulong capturedChangeSequence, |
| | | 63 | | long worldSpawnToken, |
| | | 64 | | ushort gridIndex, |
| | | 65 | | long gridSpawnToken, |
| | | 66 | | ulong gridLastChangeSequence, |
| | | 67 | | GridConfigurationKey configurationKey) |
| | | 68 | | { |
| | 74 | 69 | | AddressCount = addressCount; |
| | 74 | 70 | | Baseline = null; |
| | 74 | 71 | | PreparedPages = null; |
| | 74 | 72 | | PreparedInstance = preparedInstance; |
| | 74 | 73 | | StructuralChangedStates = structuralChangedStates; |
| | 74 | 74 | | DefaultPhysicalAddressSetChanged = defaultPhysicalAddressSetChanged; |
| | 74 | 75 | | CapturedChangeSequence = capturedChangeSequence; |
| | 74 | 76 | | WorldSpawnToken = worldSpawnToken; |
| | 74 | 77 | | GridIndex = gridIndex; |
| | 74 | 78 | | GridSpawnToken = gridSpawnToken; |
| | 74 | 79 | | GridLastChangeSequence = gridLastChangeSequence; |
| | 74 | 80 | | ConfigurationKey = configurationKey; |
| | 74 | 81 | | IsDelta = false; |
| | 74 | 82 | | IsRequested = true; |
| | 74 | 83 | | } |
| | | 84 | | |
| | | 85 | | internal int AddressCount { get; } |
| | | 86 | | |
| | | 87 | | internal GridNavigationBaseline? Baseline { get; } |
| | | 88 | | |
| | | 89 | | internal PersistentIntMap<NavigationPhysicalPage>? PreparedPages { get; } |
| | | 90 | | |
| | | 91 | | internal NavigationMapInstance? PreparedInstance { get; } |
| | | 92 | | |
| | | 93 | | internal NavigationSurfaceComponentKeySet? StructuralChangedStates { get; } |
| | | 94 | | |
| | | 95 | | internal bool DefaultPhysicalAddressSetChanged { get; } |
| | | 96 | | |
| | | 97 | | internal ulong CapturedChangeSequence { get; } |
| | | 98 | | |
| | | 99 | | internal long WorldSpawnToken { get; } |
| | | 100 | | |
| | | 101 | | internal ushort GridIndex { get; } |
| | | 102 | | |
| | | 103 | | internal long GridSpawnToken { get; } |
| | | 104 | | |
| | | 105 | | internal ulong GridLastChangeSequence { get; } |
| | | 106 | | |
| | | 107 | | internal GridConfigurationKey ConfigurationKey { get; } |
| | | 108 | | |
| | | 109 | | internal bool IsDelta { get; } |
| | | 110 | | |
| | | 111 | | internal bool IsRequested { get; } |
| | | 112 | | |
| | 1728 | 113 | | internal bool HasBaseline => Baseline != null |
| | 1728 | 114 | | || PreparedPages != null |
| | 1728 | 115 | | || PreparedInstance != null; |
| | | 116 | | } |