| 161 | } |
| 162 | |
| 163 | void update() |
| 164 | { |
| 165 | if (s_api == API_UNKNOWN) { return; } |
| 166 | |
| 167 | char scriptPath[TFE_MAX_PATH]; |
| 168 | const s32 count = (s32)s_scriptsToRun.size(); |
| 169 | const ScriptToRun* script = s_scriptsToRun.data(); |
| 170 | for (s32 i = 0; i < count; i++, script++) |
| 171 | { |
| 172 | // Does the module already exist? |
| 173 | const char* moduleName = script->moduleName.c_str(); |
| 174 | TFE_ForceScript::ModuleHandle scriptMod = TFE_ForceScript::getModule(moduleName); |
| 175 | // If not than try to load and compile it. |
| 176 | if (!scriptMod) |
| 177 | { |
| 178 | if (s_searchPath) |
| 179 | { |
| 180 | sprintf(scriptPath, "%s/%s.fs", s_searchPath, moduleName); |
| 181 | scriptMod = TFE_ForceScript::createModule(moduleName, scriptPath, false, s_api); |
| 182 | } |
| 183 | // Try loading from the archives and full search paths. |
| 184 | if (!scriptMod) |
| 185 | { |
| 186 | sprintf(scriptPath, "%s.fs", moduleName); |
| 187 | scriptMod = TFE_ForceScript::createModule(moduleName, scriptPath, true, s_api); |
| 188 | |
| 189 | } |
| 190 | } |
| 191 | if (scriptMod) |
| 192 | { |
| 193 | TFE_ForceScript::FunctionHandle func = TFE_ForceScript::findScriptFuncByName(scriptMod, script->funcName.c_str()); |
| 194 | TFE_ForceScript::execFunc(func, script->argCount, script->args); |
| 195 | } |
| 196 | } |
| 197 | s_scriptsToRun.clear(); |
| 198 | } |
| 199 | } |
nothing calls this directly
no test coverage detected