internal
| 670 | |
| 671 | // internal |
| 672 | void 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 |
| 708 | void CScriptGrid::Destruct(SGridBuffer *buf) |
nothing calls this directly
no test coverage detected