gwnavgeneration/input/inputcellinfogrid.h Source File

inputcellinfogrid.h
Go to the documentation of this file.
1 /*
2 * Copyright 2016 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 
8 #pragma once
9 
10 
14 
15 
16 namespace Kaim
17 {
18 
19 class GeneratorSystem;
20 
21 
22 class InputCellInfoGrid
23 {
24  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_NavDataGen)
25 
26 public:
27  InputCellInfoGrid() {}
28 
29  void Add(GeneratorSectorBuilder* sectorBuilder, const CellPos& cellPos, Ptr<BlobHandler<InputCellBlob> > inputCellHandler = nullptr)
30  {
31  InputCellInfoArrayAtPos* inputCellInfoArrayAtPos = m_grid.GetOrCreate(cellPos.x, cellPos.y);
32 
33  InputCellInfo inputCellInfo(sectorBuilder, cellPos, inputCellHandler);
34 
35  KY_ASSERT(inputCellInfoArrayAtPos->DoesContain(inputCellInfo) == false);
36  inputCellInfoArrayAtPos->PushBack(inputCellInfo);
37  }
38 
39  InputCellInfoArrayAtPos* GetArrayAtPos(const CellPos& pos) { return m_grid.Get(pos.x, pos.y); }
40  InputCellInfoArrayAtPos* GetArrayAtPos(CellCoord x, CellCoord y) { return m_grid.Get(x, y); }
41 
42  Ptr<InputCellInfoArrayAtPos>* GetArrayOfArray() { return m_grid.GetElements(); }
43  KyUInt32 GetArrayOfArrayCount() { return m_grid.GetElementsCount(); }
44 
45 public:
46  DenseGridAndArrayOfRefPtr<InputCellInfoArrayAtPos> m_grid;
47 };
48 
49 
50 }
51 
52 
53 
Vec2i CellPos
A type that represents the position of a cell within a 2D grid.
Definition: navmeshtypes.h:30
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:132
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
KyInt32 CellCoord
A type that represents the placement of a cell on one axis of a 2D grid.
Definition: navmeshtypes.h:29