MCPcopy Create free account
hub / github.com/MayaPosch/NymphCast / Construct

Method Construct

src/server/angelscript/add_on/scriptarray/scriptarray.cpp:948–980  ·  view source on GitHub ↗

internal

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

CreateScriptObjectMethod · 0.80
GetEngineMethod · 0.45
GetSubTypeMethod · 0.45

Tested by

no test coverage detected