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

Method GetExternalItemType

src/engine/shared/datafile.cpp:789–818  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

787}
788
789int CDataFileReader::GetExternalItemType(int InternalType, CUuid *pUuid)
790{
791 if(InternalType <= OFFSET_UUID_TYPE || InternalType == ITEMTYPE_EX)
792 {
793 if(pUuid)
794 {
795 *pUuid = UUID_ZEROED;
796 }
797 return InternalType;
798 }
799
800 const int TypeIndex = FindItemIndex(ITEMTYPE_EX, InternalType);
801 if(TypeIndex < 0 || GetItemSize(TypeIndex) < (int)sizeof(CItemEx))
802 {
803 if(pUuid)
804 {
805 *pUuid = UUID_ZEROED;
806 }
807 return InternalType;
808 }
809
810 const CItemEx *pItemEx = static_cast<const CItemEx *>(GetItem(TypeIndex));
811 const CUuid Uuid = pItemEx->ToUuid();
812 if(pUuid)
813 {
814 *pUuid = Uuid;
815 }
816 // Propagate UUID_UNKNOWN, it doesn't hurt.
817 return g_UuidManager.LookupUuid(Uuid);
818}
819
820int CDataFileReader::GetInternalItemType(int ExternalType)
821{

Callers 1

RenderDebugMethod · 0.45

Calls 2

ToUuidMethod · 0.80
LookupUuidMethod · 0.80

Tested by

no test coverage detected