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

Method SetValue

external/as_add_on/scriptarray/scriptarray.cpp:556–589  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

554}
555
556void CScriptArray::SetValue(asUINT index, void *value)
557{
558 // At() will take care of the out-of-bounds checking, though
559 // if called from the application then nothing will be done
560 void *ptr = At(index);
561 if( ptr == 0 ) return;
562
563 if( (subTypeId & ~asTYPEID_MASK_SEQNBR) && !(subTypeId & asTYPEID_OBJHANDLE) )
564 objType->GetEngine()->AssignScriptObject(ptr, value, objType->GetSubType());
565 else if( subTypeId & asTYPEID_OBJHANDLE )
566 {
567 void *tmp = *(void**)ptr;
568 *(void**)ptr = *(void**)value;
569 objType->GetEngine()->AddRefScriptObject(*(void**)value, objType->GetSubType());
570 if( tmp )
571 objType->GetEngine()->ReleaseScriptObject(tmp, objType->GetSubType());
572 }
573 else if( subTypeId == asTYPEID_BOOL ||
574 subTypeId == asTYPEID_INT8 ||
575 subTypeId == asTYPEID_UINT8 )
576 *(char*)ptr = *(char*)value;
577 else if( subTypeId == asTYPEID_INT16 ||
578 subTypeId == asTYPEID_UINT16 )
579 *(short*)ptr = *(short*)value;
580 else if( subTypeId == asTYPEID_INT32 ||
581 subTypeId == asTYPEID_UINT32 ||
582 subTypeId == asTYPEID_FLOAT ||
583 subTypeId > asTYPEID_DOUBLE ) // enums have a type id larger than doubles
584 *(int*)ptr = *(int*)value;
585 else if( subTypeId == asTYPEID_INT64 ||
586 subTypeId == asTYPEID_UINT64 ||
587 subTypeId == asTYPEID_DOUBLE )
588 *(double*)ptr = *(double*)value;
589}
590
591CScriptArray::~CScriptArray()
592{

Callers

nothing calls this directly

Calls 1

GetEngineMethod · 0.45

Tested by

no test coverage detected