| 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 | { |
nothing calls this directly
no test coverage detected