MCPcopy Create free account
hub / github.com/ddnet/ddnet / AddExtendedItemType

Method AddExtendedItemType

src/engine/shared/snapshot.cpp:807–825  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

805}
806
807bool CSnapshotBuilder::AddExtendedItemType(int Index)
808{
809 dbg_assert(m_Building, "Snapshot builder is not building snapshot. Call `AddExtendedItemType` between `Init` and `Finish`.");
810 dbg_assert(0 <= Index && Index < m_NumExtendedItemTypes, "Index out of range: %d", Index);
811
812 int *pUuidItem = static_cast<int *>(NewItem(0, GetTypeFromIndex(Index), sizeof(CUuid))); // NETOBJTYPE_EX
813 if(pUuidItem == nullptr)
814 {
815 return false;
816 }
817
818 const int TypeId = m_aExtendedItemTypes[Index];
819 const CUuid Uuid = g_UuidManager.GetUuid(TypeId);
820 for(size_t i = 0; i < sizeof(CUuid) / sizeof(int32_t); i++)
821 {
822 pUuidItem[i] = bytes_be_to_uint(&Uuid.m_aData[i * sizeof(int32_t)]);
823 }
824 return true;
825}
826
827int CSnapshotBuilder::GetExtendedItemTypeIndex(int TypeId)
828{

Callers

nothing calls this directly

Calls 2

bytes_be_to_uintFunction · 0.85
GetUuidMethod · 0.80

Tested by

no test coverage detected