MCPcopy Create free account
hub / github.com/CytopiaTeam/Cytopia / Construct

Method Construct

external/as_add_on/scriptarray/scriptarray.cpp:947–979  ·  view source on GitHub ↗

internal

Source from the content-addressed store, hash-verified

945
946// internal
947void CScriptArray::Construct(SArrayBuffer *buf, asUINT start, asUINT end)
948{
949 if( (subTypeId & asTYPEID_MASK_OBJECT) && !(subTypeId & asTYPEID_OBJHANDLE) )
950 {
951 // Create an object using the default constructor/factory for each element
952 void **max = (void**)(buf->data + end * sizeof(void*));
953 void **d = (void**)(buf->data + start * sizeof(void*));
954
955 asIScriptEngine *engine = objType->GetEngine();
956 asITypeInfo *subType = objType->GetSubType();
957
958 for( ; d < max; d++ )
959 {
960 *d = (void*)engine->CreateScriptObject(subType);
961 if( *d == 0 )
962 {
963 // Set the remaining entries to null so the destructor
964 // won't attempt to destroy invalid objects later
965 memset(d, 0, sizeof(void*)*(max-d));
966
967 // There is no need to set an exception on the context,
968 // as CreateScriptObject has already done that
969 return;
970 }
971 }
972 }
973 else
974 {
975 // Set all elements to zero whether they are handles or primitives
976 void *d = (void*)(buf->data + start * elementSize);
977 memset(d, 0, (end-start)*elementSize);
978 }
979}
980
981// internal
982void CScriptArray::Destruct(SArrayBuffer *buf, asUINT start, asUINT end)

Callers

nothing calls this directly

Calls 1

GetEngineMethod · 0.45

Tested by

no test coverage detected