protected HandleVector <int> .Handle Allocate(int item) { HandleVector <int> .Handle handle = handles.Add(item); handles.UnpackHandle(handle, out byte _, out int index); dataHandleIndices.Add(index); return(handle); }
public NavGraph(int cell_count, NavGrid nav_grid) { grid = new HandleVector <NavGraphEdge> .Handle[nav_grid.maxLinksPerCell * cell_count]; for (int i = 0; i < grid.Length; i++) { grid[i] = HandleVector <NavGraphEdge> .InvalidHandle; } edges = new HandleVector <NavGraphEdge>(cell_count); for (int j = 0; j < cell_count; j++) { int num = j * nav_grid.maxLinksPerCell; NavGrid.Link link = nav_grid.Links[num]; while (link.link != NavGrid.InvalidHandle) { NavGraphEdge item = new NavGraphEdge { startNavType = link.startNavType, endNavType = link.endNavType, endCell = link.link, startCell = j }; HandleVector <NavGraphEdge> .Handle handle = edges.Add(item); grid[num] = handle; num++; link = nav_grid.Links[num]; } grid[num] = HandleVector <NavGraphEdge> .InvalidHandle; } }
public HandleVector <T> .Handle Add(T item, string debug_info) { HandleVector <T> .Handle result = handleVector.Add(item); if (result.index >= isFree.Count) { isFree.Add(false); } else { isFree[result.index] = false; } int count = handleVector.Items.Count; while (count > debugInfo.Count) { debugInfo.Add(null); } debugInfo[result.index] = debug_info; return(result); }