MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / FillVar

Function FillVar

Source/Scripting/angelscript/asmodule.cpp:675–1236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

673}
674
675void FillVar(VarStorage& new_var, const char* name, int type_id, void* ptr, std::list<ScriptObjectInstance>& handle_var_list, asIScriptModule* module) {
676 new_var.name = name;
677 new_var.type = _vs_unknown;
678 switch (type_id) {
679 case asTYPEID_BOOL:
680 new_var.type = _vs_bool;
681 new_var.var = new bool;
682 *(bool*)new_var.var = *(bool*)ptr;
683 break;
684 case asTYPEID_INT8:
685 new_var.type = _vs_int8;
686 new_var.var = new char;
687 *(char*)new_var.var = *(char*)ptr;
688 break;
689 case asTYPEID_INT16:
690 new_var.type = _vs_int16;
691 new_var.var = new short;
692 *(short*)new_var.var = *(short*)ptr;
693 break;
694 case asTYPEID_INT32:
695 new_var.type = _vs_int32;
696 new_var.var = new int;
697 *(int*)new_var.var = *(int*)ptr;
698 break;
699 case asTYPEID_INT64:
700 new_var.type = _vs_int64;
701 new_var.var = new int64_t;
702 *(int64_t*)new_var.var = *(int64_t*)ptr;
703 break;
704 case asTYPEID_UINT8:
705 new_var.type = _vs_uint8;
706 new_var.var = new unsigned char;
707 *(unsigned char*)new_var.var = *(unsigned char*)ptr;
708 break;
709 case asTYPEID_UINT16:
710 new_var.type = _vs_uint16;
711 new_var.var = new unsigned short;
712 *(unsigned short*)new_var.var = *(unsigned short*)ptr;
713 break;
714 case asTYPEID_UINT32:
715 new_var.type = _vs_uint32;
716 new_var.var = new unsigned;
717 *(unsigned*)new_var.var = *(unsigned*)ptr;
718 break;
719 case asTYPEID_UINT64:
720 new_var.type = _vs_uint64;
721 new_var.var = new uint64_t;
722 *(uint64_t*)new_var.var = *(uint64_t*)ptr;
723 break;
724 case asTYPEID_FLOAT:
725 new_var.type = _vs_float;
726 new_var.var = new float;
727 *(float*)new_var.var = *(float*)ptr;
728 break;
729 default:
730 asIScriptEngine* engine = module->GetEngine();
731 asITypeInfo* type = engine->GetTypeInfoById(type_id);
732 if (type_id & asTYPEID_APPOBJECT) {

Callers 2

PopulateMethod · 0.85
GetGlobalVarsMethod · 0.85

Calls 15

strmtchFunction · 0.85
GetTypeInfoByIdMethod · 0.80
PopulateMethod · 0.80
DisplayErrorFunction · 0.50
GetEngineMethod · 0.45
GetNameMethod · 0.45
AddRefMethod · 0.45
GetNamespaceMethod · 0.45
c_strMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected