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

Function NewCollection

engine/gameobject/src/gameobject/gameobject.cpp:542–567  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

540 }
541
542 HCollection NewCollection(const char* name, dmResource::HFactory factory, HRegister regist, uint32_t max_instances, HCollectionDesc collection_desc)
543 {
544 if (max_instances >= INVALID_INSTANCE_INDEX)
545 {
546 dmLogError("max_instances must be less or equal to %d", INVALID_INSTANCE_INDEX - 1);
547 return 0;
548 }
549
550 Collection* collection = AllocCollection(name, regist, max_instances, (dmGameObjectDDF::CollectionDesc*)collection_desc);
551 if (!collection)
552 {
553 return 0;
554 }
555
556 collection->m_NameHash = dmHashString64(name); // Same as the socket name
557
558 HCollection hcollection = (HCollection)new CollectionHandle;
559 Result result = AttachCollection(collection, name, factory, regist, hcollection);
560 if (result != RESULT_OK)
561 {
562 DeallocCollection(collection);
563 delete hcollection;
564 return 0;
565 }
566 return hcollection;
567 }
568
569 static void DoDeleteAll(Collection* collection)
570 {

Callers 15

AcquireResourcesFunction · 0.85
SetUpMethod · 0.85
TEST_FFunction · 0.85
SetUpMethod · 0.85
TEST_FFunction · 0.85
SetUpMethod · 0.85
SetUpMethod · 0.85
SetUpMethod · 0.85
TEST_FFunction · 0.85
TEST_FFunction · 0.85
SetUpMethod · 0.85
SetUpMethod · 0.85

Calls 3

AllocCollectionFunction · 0.85
AttachCollectionFunction · 0.85
DeallocCollectionFunction · 0.85

Tested by 15

SetUpMethod · 0.68
TEST_FFunction · 0.68
SetUpMethod · 0.68
TEST_FFunction · 0.68
SetUpMethod · 0.68
SetUpMethod · 0.68
SetUpMethod · 0.68
TEST_FFunction · 0.68
TEST_FFunction · 0.68
SetUpMethod · 0.68
SetUpMethod · 0.68
SetUpMethod · 0.68