| | | 1 | | //======================================================================= |
| | | 2 | | // NavigationMapFoldWork.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 FixedMathSharp; |
| | | 9 | | using GridForge.Grids.Topology; |
| | | 10 | | |
| | | 11 | | namespace Trailblazer.Pathing; |
| | | 12 | | |
| | | 13 | | /// <summary>Advances one map install/remove candidate without rescanning its payload in one frame.</summary> |
| | | 14 | | internal sealed class NavigationMapFoldWork |
| | | 15 | | { |
| | | 16 | | private readonly NavigationOperationCandidate.MapFoldCursor _cursor; |
| | | 17 | | |
| | 1397 | 18 | | internal NavigationMapFoldWork( |
| | 1397 | 19 | | NavigationOperationCandidate source, |
| | 1397 | 20 | | PreparedNavigationMap prepared, |
| | 1397 | 21 | | OverlayReplacementPolicy replacementPolicy, |
| | 1397 | 22 | | NavigationOperationLimits limits, |
| | 1397 | 23 | | GridCellPrism[] corridorPrisms, |
| | 1397 | 24 | | Vector3d[] corridorWaypoints, |
| | 1397 | 25 | | NavigationCellAddress[] corridorAddresses, |
| | 1397 | 26 | | NavigationAddressStampSet corridorAddressSet) |
| | | 27 | | { |
| | 1397 | 28 | | _cursor = source.BeginMapFold( |
| | 1397 | 29 | | prepared, |
| | 1397 | 30 | | replacementPolicy, |
| | 1397 | 31 | | limits, |
| | 1397 | 32 | | corridorPrisms, |
| | 1397 | 33 | | corridorWaypoints, |
| | 1397 | 34 | | corridorAddresses, |
| | 1397 | 35 | | corridorAddressSet); |
| | 1397 | 36 | | } |
| | | 37 | | |
| | 18 | 38 | | internal NavigationMapFoldWork( |
| | 18 | 39 | | NavigationOperationCandidate source, |
| | 18 | 40 | | string mapId, |
| | 18 | 41 | | GridCellPrism[] corridorPrisms, |
| | 18 | 42 | | Vector3d[] corridorWaypoints, |
| | 18 | 43 | | NavigationCellAddress[] corridorAddresses, |
| | 18 | 44 | | NavigationAddressStampSet corridorAddressSet) |
| | | 45 | | { |
| | 18 | 46 | | _cursor = source.BeginMapRemovalFold( |
| | 18 | 47 | | mapId, |
| | 18 | 48 | | corridorPrisms, |
| | 18 | 49 | | corridorWaypoints, |
| | 18 | 50 | | corridorAddresses, |
| | 18 | 51 | | corridorAddressSet); |
| | 18 | 52 | | } |
| | | 53 | | |
| | 61656 | 54 | | internal NavigationOperationCandidate Candidate => _cursor.Candidate; |
| | | 55 | | |
| | 9258 | 56 | | internal long DisplacedExplicitPayloadBytes => _cursor.DisplacedExplicitPayloadBytes; |
| | | 57 | | |
| | 9259 | 58 | | internal int DisplacedExplicitPayloadPages => _cursor.DisplacedExplicitPayloadPages; |
| | | 59 | | |
| | 9261 | 60 | | internal long DisplacedMapStatePayloadBytes => _cursor.DisplacedMapStatePayloadBytes; |
| | | 61 | | |
| | 9261 | 62 | | internal int DisplacedMapStatePayloadPages => _cursor.DisplacedMapStatePayloadPages; |
| | | 63 | | |
| | 9260 | 64 | | internal long RetainedBytes => _cursor.RetainedBytes; |
| | | 65 | | |
| | 9261 | 66 | | internal int PersistentPageCount => _cursor.PersistentPageCount; |
| | | 67 | | |
| | | 68 | | internal bool Advance(MaintenanceWorkMeter meter, out NavigationOperationRejection rejection) => |
| | 4565 | 69 | | _cursor.Advance(meter, out rejection); |
| | | 70 | | } |