Working on probe: drv_call_function can now return a string
This commit is contained in:
@@ -475,11 +475,16 @@ void DrivenEngine::drv_update(double clock) {
|
||||
event_update();
|
||||
}
|
||||
|
||||
void DrivenEngine::drv_call_function(InvocationKind kind, int64_t place, uint32_t datapklen, const char *datapk) {
|
||||
Invocation *inv = new Invocation(kind, visible_actor_id_, place, std::string_view(datapk, datapklen));
|
||||
void DrivenEngine::drv_call_function(InvocationKind kind, int64_t place, uint32_t datapklen, const char *datapk, uint32_t *retpklen, const char **retpk) {
|
||||
// This next line is a hack, because the DrivenEngine is not supposed to care about 'kind'.
|
||||
if (kind == InvocationKind::LUA_SOURCE) rescan_lua_source_ = false;
|
||||
event_call_function(kind, place, std::string_view(datapklen, datapk));
|
||||
call_function_retpk_.clear();
|
||||
event_call_function(kind, place, std::string_view(datapk, datapklen), &call_function_retpk_);
|
||||
if (retpklen != nullptr) {
|
||||
std::string_view view = call_function_retpk_.view();
|
||||
*retpklen = view.size();
|
||||
*retpk = view.data();
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -806,7 +811,7 @@ static void replay_update(EngineWrapper *w) {
|
||||
////////////////////////
|
||||
|
||||
|
||||
void play_call_function(EngineWrapper *w, InvocationKind kind, int64_t place, uint32_t datapklen, const char *datapk) {
|
||||
void play_call_function(EngineWrapper *w, InvocationKind kind, int64_t place, uint32_t datapklen, const char *datapk, uint32_t *retpklen, const char **retpk) {
|
||||
assert(w->rlog == nullptr);
|
||||
if (w->wlog != nullptr) {
|
||||
w->wlog->write_cmd_hash(PLAY_CALL_FUNCTION, eng::memhash());
|
||||
@@ -816,7 +821,7 @@ void play_call_function(EngineWrapper *w, InvocationKind kind, int64_t place, ui
|
||||
w->wlog->flush();
|
||||
}
|
||||
|
||||
w->engine->drv_call_function(kind, place, datapklen, datapk);
|
||||
w->engine->drv_call_function(kind, place, datapklen, datapk, retpklen, retpk);
|
||||
}
|
||||
|
||||
void replay_call_function(EngineWrapper *w) {
|
||||
@@ -827,7 +832,7 @@ void replay_call_function(EngineWrapper *w) {
|
||||
return reset_wrapper(w, "replay log corrupt in replay_call_function_lua_call");
|
||||
}
|
||||
|
||||
w->engine->drv_call_function(kind, place, srcpack.size(), srcpack.c_str());
|
||||
w->engine->drv_call_function(kind, place, srcpack.size(), srcpack.c_str(), nullptr, nullptr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user