| | | 1 | | //======================================================================= |
| | | 2 | | // NavigationPhysicalPage.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 sealed class NavigationPhysicalPage |
| | | 11 | | { |
| | | 12 | | internal const int SlotCount = 64; |
| | | 13 | | |
| | 1721 | 14 | | internal NavigationPhysicalPage(int pageIndex, long version = 0) |
| | | 15 | | { |
| | 1721 | 16 | | PageIndex = pageIndex; |
| | 1721 | 17 | | Version = version; |
| | 1721 | 18 | | IsPresent = new bool[SlotCount]; |
| | 1721 | 19 | | ObstacleCounts = new byte[SlotCount]; |
| | 1721 | 20 | | } |
| | | 21 | | |
| | 287 | 22 | | private NavigationPhysicalPage(int pageIndex, long version, bool[] isPresent, byte[] obstacleCounts) |
| | | 23 | | { |
| | 287 | 24 | | PageIndex = pageIndex; |
| | 287 | 25 | | Version = version; |
| | 287 | 26 | | IsPresent = isPresent; |
| | 287 | 27 | | ObstacleCounts = obstacleCounts; |
| | 287 | 28 | | } |
| | | 29 | | |
| | | 30 | | internal int PageIndex { get; } |
| | | 31 | | |
| | | 32 | | internal long Version { get; } |
| | | 33 | | |
| | | 34 | | internal bool[] IsPresent { get; } |
| | | 35 | | |
| | | 36 | | internal byte[] ObstacleCounts { get; } |
| | | 37 | | |
| | 287 | 38 | | internal NavigationPhysicalPage Clone(long version) => new( |
| | 287 | 39 | | PageIndex, |
| | 287 | 40 | | version, |
| | 287 | 41 | | (bool[])IsPresent.Clone(), |
| | 287 | 42 | | (byte[])ObstacleCounts.Clone()); |
| | | 43 | | } |