Tests if the interaction handler is referencing an existing function in script. Writes down the result of the test for the future use.
| 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. |
| 133 | static 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 |
| 152 | int run_event_script(const ObjectEvent &obj_evt, ScriptEventsBase *handlers, int evnt, |
no test coverage detected