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

Method CallMPCallBack

Source/Scripting/angelscript/ascontext.cpp:834–861  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

832}
833
834bool ASContext::CallMPCallBack(uint32_t state, const std::vector<char> &data) {
835 if (mpCallBacks.find(state) != mpCallBacks.end()) {
836 if (HasFunction(mpCallBacks[state])) {
837 ASArglist args;
838 asITypeInfo *arrayType = engine->GetTypeInfoById(engine->GetTypeIdByDecl("array<uint8>"));
839 CScriptArray *array = CScriptArray::Create(arrayType, (asUINT)0);
840 array->Reserve(data.size());
841 for (const char &i : data) {
842 array->InsertLast(const_cast<char *>(&i));
843 }
844
845 args.AddAddress((void *)array);
846
847 CallScriptFunction(mpCallBacks[state], &args);
848
849 array->Release();
850
851 return true;
852 } else {
853 LOGE << this << " Failed to call function, state does not have a binded function. Handle ID: " << mpCallBacks[state] << std::endl;
854 return false;
855 }
856
857 return false;
858 }
859
860 return false;
861}
862
863bool ASContext::CallMPCallBack(uint32_t state, const std::vector<unsigned int> &data) {
864 if (mpCallBacks.find(state) != mpCallBacks.end()) {

Callers 3

UpdateMethod · 0.80
UpdateMethod · 0.80
ASCallStateMPCallbackFunction · 0.80

Calls 10

GetTypeInfoByIdMethod · 0.80
AddAddressMethod · 0.80
CreateFunction · 0.50
findMethod · 0.45
endMethod · 0.45
GetTypeIdByDeclMethod · 0.45
ReserveMethod · 0.45
sizeMethod · 0.45
InsertLastMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected