MCPcopy Create free account
hub / github.com/adventuregamestudio/ags / test_interaction_handler

Function test_interaction_handler

Engine/script/script.cpp:133–149  ·  view source on GitHub ↗

Tests if the interaction handler is referencing an existing function in script. Writes down the result of the test for the future use.

Source from the content-addressed store, hash-verified

131// Tests if the interaction handler is referencing an existing function in script.
132// Writes down the result of the test for the future use.
133static bool test_interaction_handler(ScriptEventsBase *handlers, int evnt, bool in_room)
134{
135 if (!handlers->HasHandler(evnt))
136 return false;
137 auto &handler = handlers->GetHandler(static_cast<size_t>(evnt));
138 if (!handler.IsChecked())
139 {
140 if (in_room)
141 handler.SetChecked(DoesScriptFunctionExist(roomscript.get(), handler.FunctionName));
142 else
143 handler.SetChecked(DoesScriptFunctionExistInModule(handlers->GetScriptModule(), handler.FunctionName));
144
145 if (!handler.IsEnabled())
146 WarnEventFunctionNotFound(ScriptFunctionRef(handlers->GetScriptModule(), handler.FunctionName), in_room);
147 }
148 return handler.IsEnabled();
149}
150
151// Runs new-style interaction event handler in script
152int run_event_script(const ObjectEvent &obj_evt, ScriptEventsBase *handlers, int evnt,

Callers 2

run_event_scriptFunction · 0.85
run_event_script_alwaysFunction · 0.85

Calls 10

DoesScriptFunctionExistFunction · 0.85
ScriptFunctionRefClass · 0.85
HasHandlerMethod · 0.80
GetHandlerMethod · 0.80
IsCheckedMethod · 0.80
SetCheckedMethod · 0.80
getMethod · 0.45
IsEnabledMethod · 0.45

Tested by

no test coverage detected