MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / update

Function update

TheForceEngine/TFE_ForceScript/forceScript.cpp:651–677  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

649 }
650
651 void update(f32 dt)
652 {
653 if (dt == 0.0f) { dt = (f32)TFE_System::getDeltaTime(); }
654 const s32 count = (s32)s_scriptThreads.size();
655 ScriptThread* thread = s_scriptThreads.data();
656 for (s32 i = 0; i < count; i++)
657 {
658 // Allow for holes to keep IDs consistent.
659 // Fill holes with new threads.
660 if (thread[i].asContext == nullptr) { continue; }
661
662 thread[i].delay = std::max(0.0f, thread[i].delay - dt);
663 if (thread[i].delay == 0.0f)
664 {
665 asIScriptContext* context = thread[i].asContext;
666 const s32 res = context->Execute();
667 if (res != asEXECUTION_SUSPENDED)
668 {
669 // Finally done!
670 s_engine->ReturnContext(context);
671 thread[i].asContext = nullptr;
672 thread[i].delay = 0.0f;
673 s_freeThreads.push_back(i);
674 }
675 }
676 }
677 }
678
679 void stopAllFunc()
680 {

Callers

nothing calls this directly

Calls 7

getDeltaTimeFunction · 0.85
maxFunction · 0.85
dataMethod · 0.80
ReturnContextMethod · 0.80
push_backMethod · 0.80
sizeMethod · 0.45
ExecuteMethod · 0.45

Tested by

no test coverage detected