| 83 | //============================================================================= |
| 84 | |
| 85 | VMFunction* LookupFunction(const char* qname, bool validate) |
| 86 | { |
| 87 | size_t p = strcspn(qname, "."); |
| 88 | if (p == 0) |
| 89 | I_Error("Call to undefined function %s", qname); |
| 90 | FName clsname(qname, p, true); |
| 91 | FName funcname(qname + p + 1, true); |
| 92 | |
| 93 | auto func = PClass::FindFunction(clsname, funcname); |
| 94 | if (func == nullptr) |
| 95 | I_Error("Call to undefined function %s", qname); |
| 96 | if (validate) |
| 97 | { |
| 98 | // these conditions must be met by all functions for this interface. |
| 99 | if (func->Proto->ReturnTypes.Size() != 0) I_Error("Bad cutscene function %s. Return value not allowed", qname); |
| 100 | if (func->ImplicitArgs != 0) I_Error("Bad cutscene function %s. Must be static", qname); |
| 101 | } |
| 102 | return func; |
| 103 | } |
| 104 | |
| 105 | //============================================================================= |
| 106 | // |
no test coverage detected