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

Method SetValue

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 5

AssignScriptObjectMethod · 0.80
AddRefScriptObjectMethod · 0.80
ReleaseScriptObjectMethod · 0.80
GetEngineMethod · 0.45
GetSubTypeMethod · 0.45

Tested by

no test coverage detected