MCPcopy Create free account
hub / github.com/OpenDUNE/OpenDUNE / Script_LoadAsSubroutine

Function Script_LoadAsSubroutine

src/script/script.c:573–587  ·  view source on GitHub ↗

* Load a script in an engine without removing the previously loaded script. * * @param script The script engine to run. * @param typeID The typeID for which we want to load a script. */

Source from the content-addressed store, hash-verified

571 * @param typeID The typeID for which we want to load a script.
572 */
573void Script_LoadAsSubroutine(ScriptEngine *script, uint8 typeID)
574{
575 ScriptInfo *scriptInfo;
576
577 if (!Script_IsLoaded(script)) return;
578 if (script->isSubroutine != 0) return;
579
580 scriptInfo = script->scriptInfo;
581 script->isSubroutine = 1;
582
583 STACK_PUSH((uint16)(script->script - scriptInfo->start));
584 STACK_PUSH(script->returnValue);
585
586 script->script = scriptInfo->start + scriptInfo->offsets[typeID];
587}
588
589/**
590 * Clears the given scriptInfo.

Callers 1

Unit_SetActionFunction · 0.85

Calls 1

Script_IsLoadedFunction · 0.85

Tested by

no test coverage detected