MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / ASGetChildren

Function ASGetChildren

Source/Scripting/angelscript/asfuncs.cpp:2784–2804  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2782}
2783
2784CScriptArray* ASGetChildren(Object* obj) {
2785 if (obj->GetType() != _group) {
2786 return NULL;
2787 }
2788
2789 Group* group = static_cast<Group*>(obj);
2790
2791 asIScriptContext* ctx = asGetActiveContext();
2792 asIScriptEngine* engine = ctx->GetEngine();
2793 asITypeInfo* arrayType = engine->GetTypeInfoById(engine->GetTypeIdByDecl("array<int>"));
2794 CScriptArray* array = CScriptArray::Create(arrayType, (asUINT)0);
2795 array->Reserve(group->children.size());
2796
2797 for (const auto& iter : group->children) {
2798 int val = iter.direct_ptr->GetID();
2799 if (val != -1) {
2800 array->InsertLast(&val);
2801 }
2802 }
2803 return array;
2804}
2805
2806static int ASObjectGetID(Object* obj) {
2807 return obj->GetID();

Callers

nothing calls this directly

Calls 9

GetTypeInfoByIdMethod · 0.80
CreateFunction · 0.50
GetTypeMethod · 0.45
GetEngineMethod · 0.45
GetTypeIdByDeclMethod · 0.45
ReserveMethod · 0.45
sizeMethod · 0.45
GetIDMethod · 0.45
InsertLastMethod · 0.45

Tested by

no test coverage detected