MCPcopy Create free account
hub / github.com/anjo76/angelscript / Construct

Method Construct

sdk/add_on/scriptgrid/scriptgrid.cpp:672–705  ·  view source on GitHub ↗

internal

Source from the content-addressed store, hash-verified

670
671// internal
672void CScriptGrid::Construct(SGridBuffer *buf)
673{
674 assert( buf );
675
676 if( subTypeId & asTYPEID_OBJHANDLE )
677 {
678 // Set all object handles to null
679 void *d = (void*)(buf->data);
680 memset(d, 0, (buf->width*buf->height)*sizeof(void*));
681 }
682 else if( subTypeId & asTYPEID_MASK_OBJECT )
683 {
684 void **max = (void**)(buf->data + (buf->width*buf->height) * sizeof(void*));
685 void **d = (void**)(buf->data);
686
687 asIScriptEngine *engine = objType->GetEngine();
688 asITypeInfo *subType = objType->GetSubType();
689
690 for( ; d < max; d++ )
691 {
692 *d = (void*)engine->CreateScriptObject(subType);
693 if( *d == 0 )
694 {
695 // Set the remaining entries to null so the destructor
696 // won't attempt to destroy invalid objects later
697 memset(d, 0, sizeof(void*)*(max-d));
698
699 // There is no need to set an exception on the context,
700 // as CreateScriptObject has already done that
701 return;
702 }
703 }
704 }
705}
706
707// internal
708void CScriptGrid::Destruct(SGridBuffer *buf)

Callers

nothing calls this directly

Calls 3

CreateScriptObjectMethod · 0.80
GetEngineMethod · 0.45
GetSubTypeMethod · 0.45

Tested by

no test coverage detected