int CCobInstance::Call(const std::string& fname, std::vector<int>& args, CBCobThreadFinish cb, void* p1, void* p2) { int fn = GetFunctionId(fname); //TODO: Check that new behaviour of actually calling cb when the function is not defined is right? // (the callback has always been called [when the function is not defined] // in the id-based Call()s, but never in the string based calls.) return RealCall(fn, args, cb, p1, p2); }
int CCobInstance::Call(const string &fname, vector<int> &args, CBCobThreadFinish cb, void *p1, void *p2) { int fn = script.getFunctionId(fname); if (fn == -1) { //logOutput.Print("CobError: unknown function %s called by user", fname.c_str()); return -1; } return RealCall(fn, args, cb, p1, p2); }
int CCobInstance::Call(int id, vector<int> &args, CBCobThreadFinish cb, void *p1, void *p2) { int fn = script.scriptIndex[id]; if (fn == -1) { //logOutput.Print("CobError: unknown function index %d called by user", id); if(cb){ (*cb)(0, p1, p2); //in case the function doesnt exist the callback should still be called } return -1; } return RealCall(fn, args, cb, p1, p2); }
int CCobInstance::RawCall(int fn, std::vector<int> &args) { return RealCall(fn, args, NULL, NULL, NULL); }
void CCobInstance::RawCall(int fn) { vector<int> x; RealCall(fn, x, NULL, NULL, NULL); }
int CCobInstance::Call(int id, std::vector<int>& args, CBCobThreadFinish cb, void* p1, void* p2) { return RealCall(script.scriptIndex[id], args, cb, p1, p2); }