10 #ifndef Navigation_ActiveDataBlob_H
11 #define Navigation_ActiveDataBlob_H
23 ActiveSectorType_NavMesh = 0,
24 ActiveSectorType_NavGraph = 1,
25 ActiveSectorType_AbstractGraph = 2,
30 class ActiveSectorBlob
36 BlobArray<char> m_sectorName;
37 BlobArray<char> m_sectorRelativeDir;
43 SwapEndianness(e,
self.m_guid);
44 SwapEndianness(e,
self.m_sectorName);
45 SwapEndianness(e,
self.m_sectorRelativeDir);
46 SwapEndianness(e,
self.m_activeSectorType);
49 class ActiveSectorBlobBuilder :
public BaseBlobBuilder<ActiveSectorBlob>
52 static ActiveSectorType GetActiveSectorType(
const NavData* navData)
54 if (navData->GetNavMeshElementBlobCollection().GetCount() != 0)
55 return ActiveSectorType_NavMesh;
56 else if (navData->GetNavGraphBlobCollection().GetCount() != 0)
57 return ActiveSectorType_NavGraph;
58 else if (navData->GetAbstractGraphBlobCollection().GetCount() != 0)
59 return ActiveSectorType_AbstractGraph;
60 return ActiveSectorType_Undefined;
64 ActiveSectorBlobBuilder(
const KyGuid& guid,
const String& sectorName,
const String& sectorRelativeDir, ActiveSectorType activeSectorType)
65 : m_guid(guid), m_sectorName(sectorName), m_sectorRelativeDir(sectorRelativeDir), m_activeSectorType(activeSectorType) {}
77 String m_sectorRelativeDir;
78 ActiveSectorType m_activeSectorType;
83 KY_ROOT_BLOB_CLASS(NavData, ActiveDataBlob, 0)
90 BlobArray<ActiveSectorBlob> m_activeSectors;
95 SwapEndianness(e,
self.m_databaseIndex);
96 SwapEndianness(e,
self.m_activeSectors);
99 class ActiveDataBlobBuilder :
public BaseBlobBuilder<ActiveDataBlob>
102 ActiveDataBlobBuilder(
const Database* db) : m_db(db) {}
111 KyArray<Kaim::NavData*> navDataToBuild;
112 for (
KyUInt32 i = 0; i < m_db->m_navDatas.GetCount(); ++i)
117 navDataToBuild.PushBack(navData);
121 ActiveSectorBlob* activeSectors =
BLOB_ARRAY(
m_blob->m_activeSectors, navDataToBuild.GetCount());
122 for (
KyUInt32 i = 0; i < navDataToBuild.GetCount(); ++i)
124 NavData* navData = navDataToBuild[i];
125 KY_DEBUG_ERRORN_IF(navData->GetSectorName() ==
"", (
"Error in ActiveDataBlobBuilder, we should not build ActiveDataBlob for this navData"));
127 const KyGuid* guid = navData->GetMainGuid();
131 ActiveSectorType sectorType = ActiveSectorBlobBuilder::GetActiveSectorType(navData);
132 BLOB_BUILD(activeSectors[i], ActiveSectorBlobBuilder(*guid, navData->m_sectorDescriptor.m_sectorName, navData->m_sectorDescriptor.m_generatorRelativeOutputDirectory, sectorType));
136 const Database* m_db;
142 class ActiveGuidsBlob
144 KY_ROOT_BLOB_CLASS(NavData, ActiveGuidsBlob, 0)
150 BlobArray<KyGuid> m_guids;
155 SwapEndianness(e,
self.m_guids);
158 class ActiveGuidsBlobBuilder :
public BaseBlobBuilder<ActiveGuidsBlob>
162 ActiveGuidsBlobBuilder(KyArray<KyGuid, MemStat_NavData>* activeGuids) : m_activeGuids(activeGuids) {}
166 if (m_activeGuids == NULL)
172 KyArray<KyGuid, MemStat_NavData>* m_activeGuids;
#define BLOB_SET(blob, value)
Use this macro only in implementations of BaseBlobBuilder::DoBuild().
Definition: baseblobbuilder.h:136
const String & GetSectorName() const
Returns the Name passed to Kaim::GeneratorSector.
#define BLOB_BUILD(blob, builder)
Use this macro only in implementations of BaseBlobBuilder::DoBuild().
Definition: baseblobbuilder.h:189
#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
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:35
The NavData class is the object containing navigation data that will be added to one Database...
Definition: navdata.h:44
#define KyUInt8MAXVAL
The maximum value that can be stored in the KyUInt8 variable type.
Definition: types.h:233
static const KyGuid & GetInvalidGuid()
Returns the invalid KyGuid value.
unsigned char KyUInt8
Type used internally to represent an unsigned 8-bit integer.
Definition: types.h:41
ActiveSectorBlob * m_blob
The blob maintained by this builder. Only modify using the macros listed under DoBuild().
Definition: baseblobbuilder.h:117
Definition: gamekitcrowddispersion.h:20
#define BLOB_ARRAY_COPY_2(blobArray, ky_array)
same as BLOB_ARRAY_COPY but uses Kaim::Array as input
Definition: baseblobbuilder.h:165
#define BLOB_STRING(str, src)
Use this macro only in implementations of BaseBlobBuilder::DoBuild().
Definition: baseblobbuilder.h:179
#define BLOB_ARRAY(blobArray, count)
Use this macro only in implementations of BaseBlobBuilder::DoBuild().
Definition: baseblobbuilder.h:147
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
#define KyUInt32MAXVAL
The maximum value that can be stored in the KyUInt32 variable type.
Definition: types.h:226