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

Method RegisterMPStateCallback

Source/Scripting/angelscript/ascontext.cpp:816–832  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

814}
815
816void ASContext::RegisterMPStateCallback(uint32_t state, const std::string &callbackFunction) {
817 if (mpCallBacks.find(state) != mpCallBacks.end()) {
818 return;
819 }
820
821 ASFunctionHandle handle = RegisterExpectedFunction(callbackFunction, false);
822
823 asIScriptFunction *func = module.GetFunctionID(expected_functions[handle].definition);
824
825 if (func != nullptr) {
826 mpCallBacks[state] = handle;
827 LOGI << " STATE: " << state << " is now connected to " << callbackFunction << " via expected function handle: " << handle << std::endl;
828 LoadExpectedFunctions();
829 } else {
830 LOGE << "FAILED TO BIND YOUR STATE: " << state << " TO " << callbackFunction << ". CHECK DEFINITION OF FUNCTION AND SCOPE OF CONTEXT" << std::endl;
831 }
832}
833
834bool ASContext::CallMPCallBack(uint32_t state, const std::vector<char> &data) {
835 if (mpCallBacks.find(state) != mpCallBacks.end()) {

Callers 1

Calls 3

GetFunctionIDMethod · 0.80
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected