gwnavruntime/database/activeguids.h Source File

activeguids.h
Go to the documentation of this file.
1 /*
2 * Copyright 2015 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 
9 // ---------- Primary contact: JUBA - secondary contact: NOBODY
10 #ifndef Navigation_ActiveGuids_H
11 #define Navigation_ActiveGuids_H
12 
16 
17 namespace Kaim
18 {
19 
20 class NavMeshElement;
21 
22 class ActiveGuids
23 {
24  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_NavData)
25 public:
26  void AddActiveKyGuid(const KyGuid& kyGuid);
27  void RemoveActiveKyGuid(const KyGuid& kyGuid);
28 
29  //activatedGuid must be sorted
30  KY_INLINE bool IsGuidCompoundCompatible(const GuidCompound& guidCompound) const
31  {
32  if (guidCompound.GetKyGuidCount() == 1)
33  // we assume that all the GuidCompound with only one KyGuid are compatible since they are from a "main" sector
34  return true;
35 
36  return IsNotMainGuidCompoundCompatible(guidCompound);
37  }
38 
39  void Clear() { m_activeGuids.ClearAndRelease(); }
40 
41 private :
42  bool IsNotMainGuidCompoundCompatible(const GuidCompound& guidCompound) const;
43 
44 public:
45  KyArray<KyGuid, MemStat_NavData> m_activeGuids;
46 };
47 
48 class GuidCompoundSorter
49 {
50  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_WorldFwk)
51  KY_CLASS_WITHOUT_COPY(GuidCompoundSorter)
52 
53 public:
54  GuidCompoundSorter() {}
55  class GuidCompoundSorterElement
56  {
57  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_WorldFwk)
58  public:
59  GuidCompoundSorterElement() : m_guidCompound(KY_NULL), m_navMeshElement(KY_NULL) {}
60  GuidCompoundSorterElement(NavMeshElement* navMeshElement, const GuidCompound* guidCompound) : m_guidCompound(guidCompound), m_navMeshElement(navMeshElement) {}
61 
62  const GuidCompound* m_guidCompound;
63  NavMeshElement* m_navMeshElement;
64  };
65 
66  void AddNavMeshElement(NavMeshElement* navMeshElement);
67  void RemoveNavMeshElement(NavMeshElement* navMnavMeshElementesh);
68  void Sort(ActiveGuids& activeGuids, CellBox& currentUpdateCellBox, bool forceActiveIfAlone = false);
69 public:
70 
71  KyArray<GuidCompoundSorterElement, MemStat_NavData> m_guidCompoundArray;
72 };
73 
74 }
75 
76 
77 #endif //Navigation_ActiveGuids_H
78 
Box2i CellBox
A type that represents a bounding box around cells in a 2D grid.
Definition: navmeshtypes.h:34
#define KY_NULL
Null value.
Definition: types.h:247
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:387
Definition: gamekitcrowddispersion.h:20
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137