MCPcopy Create free account
hub / github.com/defold/defold / AllocateResourceType

Function AllocateResourceType

engine/resource/src/resource.cpp:420–440  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

418}
419
420HResourceType AllocateResourceType(HFactory factory, const char* extension)
421{
422 if (factory->m_ResourceTypesCount == MAX_RESOURCE_TYPES)
423 {
424 dmLogError("Cannot allocate a new resource type!");
425 return 0;
426 }
427
428 // Dots not allowed in extension
429 if (strrchr(extension, '.') != 0)
430 {
431 dmLogError("No '.' is allowed for the resource type '%s'", extension);
432 return 0;
433 }
434
435 // Note, we don't increase the counter it at this point
436 HResourceType type = &factory->m_ResourceTypes[factory->m_ResourceTypesCount++];
437 ResourceTypeReset(type);
438 type->m_Index = factory->m_ResourceTypesCount - 1;
439 return type;
440}
441
442void FreeResourceType(HFactory factory, HResourceType type)
443{

Callers 2

RegisterTypesFunction · 0.85
RegisterTypeFunction · 0.85

Calls 1

ResourceTypeResetFunction · 0.85

Tested by

no test coverage detected